/* TinySamkok — UI (DOM) stylesheet  ·  ธีมวูเซีย: พื้นเข้ม ขอบทอง แดงชาด ตัวอักษรครีม */
:root {
  --bg0: #14100c; --bg1: #1d1712; --bg2: #2a2119; --bg3: #3a2d21;
  --gold: #c9a45c; --gold-hi: #f0d28a; --gold-lo: #6e5732; --gold-a: rgba(201, 164, 92, .35);
  --verm: #8e2b2b; --verm-hi: #b8402f; --verm-lo: #4a1515;
  --cream: #f3e6c8; --text2: #d8c8a8; --muted: #b3a283; --dim: #85765f;
  --jade: #4f9a8a; --good: #8fe08f; --bad: #ff7b6b; --warn: #ffc857;
  --hp1: #8e1a22; --hp2: #e8553a; --mp1: #1f3f9a; --mp2: #4aa3df; --exp1: #8a6418; --exp2: #f0d28a;
  --font-h: 'Kanit', 'Leelawadee UI', 'Leelawadee', 'Tahoma', sans-serif;
  --font-b: 'Sarabun', 'Leelawadee UI', 'Leelawadee', 'Tahoma', sans-serif;
  --font-cn: 'Ma Shan Zheng', 'Kanit', 'KaiTi', 'STKaiti', 'Kaiti SC', serif;
  --r: 6px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--cream); font-family: var(--font-b); -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
/* ค่าเริ่มต้นของ canvas / battle-ui (scene.css ของ Scenes agent โหลดทีหลังและ override ได้) */
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
#battle-ui { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#ui-root { position: absolute; inset: 0; pointer-events: none; font-family: var(--font-b); font-size: 14px; line-height: 1.4; user-select: none; -webkit-user-select: none; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg0); color: var(--cream); font: 18px var(--font-b); }

.layer { position: fixed; inset: 0; pointer-events: none; }
.layer-hud { z-index: 30; } .layer-win { z-index: 50; } .layer-pop { z-index: 80; } .layer-toast { z-index: 90; } .layer-screen { z-index: 100; } .layer-overlay { z-index: 200; }
/* หน้าสร้างตัวละคร: tooltip และกล่องยืนยันต้องอยู่เหนือหน้าจอเต็ม */
#ui-root[data-scene="create"] .layer-pop { z-index: 110; }
#ui-root[data-scene="create"] .layer-toast { z-index: 120; }
.hidden { display: none !important; }
#ui-root button { font-family: var(--font-h); -webkit-user-select: none; user-select: none; }
#ui-root input { font-family: var(--font-b); user-select: text; -webkit-user-select: text; }
#ui-root ::-webkit-scrollbar { width: 8px; height: 8px; }
#ui-root ::-webkit-scrollbar-thumb { background: #5a4630; border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
#ui-root ::-webkit-scrollbar-thumb:hover { background-color: #7a6040; }
#ui-root ::-webkit-scrollbar-track { background: rgba(0, 0, 0, .15); }
.ok { color: var(--good); } .bad { color: var(--bad) !important; } .warn { color: var(--warn); } .dim { color: var(--dim); font-size: 12.5px; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- พื้นฐาน: แผง ปุ่ม ช่องกรอก */
.panel { position: relative; background: linear-gradient(180deg, rgba(38, 29, 21, .97), rgba(19, 15, 11, .97)); border: 1px solid var(--gold); border-radius: var(--r); box-shadow: 0 0 0 1px #000, 0 0 0 3px rgba(201, 164, 92, .14), 0 14px 40px rgba(0, 0, 0, .65), inset 0 0 40px rgba(0, 0, 0, .45); color: var(--cream); }
.orn::after { content: ''; position: absolute; inset: 4px; pointer-events: none; border-radius: 3px; border: 1px solid rgba(201, 164, 92, .14);
  background:
    linear-gradient(var(--gold), var(--gold)) left top / 14px 2px no-repeat, linear-gradient(var(--gold), var(--gold)) left top / 2px 14px no-repeat,
    linear-gradient(var(--gold), var(--gold)) right top / 14px 2px no-repeat, linear-gradient(var(--gold), var(--gold)) right top / 2px 14px no-repeat,
    linear-gradient(var(--gold), var(--gold)) left bottom / 14px 2px no-repeat, linear-gradient(var(--gold), var(--gold)) left bottom / 2px 14px no-repeat,
    linear-gradient(var(--gold), var(--gold)) right bottom / 14px 2px no-repeat, linear-gradient(var(--gold), var(--gold)) right bottom / 2px 14px no-repeat; }
.panel-lite { background: linear-gradient(180deg, rgba(26, 20, 15, .86), rgba(16, 12, 9, .82)); border: 1px solid rgba(201, 164, 92, .55); border-radius: var(--r); box-shadow: 0 0 0 1px rgba(0, 0, 0, .7), 0 4px 14px rgba(0, 0, 0, .45); }
.panel-title { margin: -1px -1px 0; padding: 9px 16px; text-align: center; font: 600 16px var(--font-h); color: var(--gold-hi); letter-spacing: .5px; background: linear-gradient(180deg, #742222, #481515); border-bottom: 1px solid var(--gold); border-radius: var(--r) var(--r) 0 0; text-shadow: 0 1px 2px #000; }
.panel-title span::before, .panel-title span::after, .win-title span::before, .win-title span::after { content: '◆'; font-size: 8px; color: var(--gold); margin: 0 10px; vertical-align: 3px; }

.btn { pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px; font: 500 14px var(--font-h); color: var(--cream); background: linear-gradient(180deg, #3b2e22, #231a13); border: 1px solid var(--gold-lo); border-radius: 4px; cursor: pointer; text-shadow: 0 1px 0 #000; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 1px 2px rgba(0, 0, 0, .5); transition: border-color .15s, box-shadow .15s, filter .15s; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--gold); color: #fff; box-shadow: 0 0 10px rgba(201, 164, 92, .35), inset 0 1px 0 rgba(255, 255, 255, .1); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(180deg, #b63c2f, #761f1f); border-color: var(--gold); color: #fff4dc; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn-danger { background: linear-gradient(180deg, #6c2020, #3e1111); border-color: #a5503e; }
.btn-jade { background: linear-gradient(180deg, #3f8d78, #22564a); border-color: #8fd8c0; color: #eafff6; }
.btn-ghost { background: transparent; border-color: rgba(201, 164, 92, .3); color: var(--muted); }
.btn-lg { min-height: 44px; padding: 8px 22px; font-size: 16px; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.ico { display: inline-flex; width: 1.2em; height: 1.2em; flex: none; }
.ico svg { width: 100%; height: 100%; }
.input { pointer-events: auto; width: 100%; min-height: 40px; padding: 8px 10px; font: 15px var(--font-b); color: var(--cream); background: rgba(0, 0, 0, .45); border: 1px solid var(--gold-lo); border-radius: 4px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201, 164, 92, .2); }
.input.invalid { border-color: var(--bad); }
.input::placeholder { color: #7d6f58; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* แท่ง HP/MP/EXP */
.bar { position: relative; height: 16px; background: rgba(0, 0, 0, .65); border: 1px solid #000; box-shadow: 0 0 0 1px rgba(201, 164, 92, .3); border-radius: 3px; overflow: hidden; }
.bar.thin { height: 6px; border-radius: 2px; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; transition: width .35s ease; }
.bar-fill::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 45%; background: linear-gradient(rgba(255, 255, 255, .38), rgba(255, 255, 255, 0)); }
.bar-hp .bar-fill { background: linear-gradient(90deg, var(--hp1), var(--hp2)); }
.bar-mp .bar-fill { background: linear-gradient(90deg, var(--mp1), var(--mp2)); }
.bar-exp .bar-fill { background: linear-gradient(90deg, var(--exp1), var(--exp2)); }
.bar-text { position: relative; font: 500 11px/14px var(--font-h); text-align: center; color: #fff; text-shadow: 0 0 2px #000, 0 1px 1px #000, 0 0 3px #000; letter-spacing: .3px; white-space: nowrap; }
.bar.thin .bar-text { display: none; }
.bar-hp.low .bar-fill { animation: lowhp .8s infinite alternate; }

.coin { display: inline-block; position: relative; flex: none; width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b8, #e2b04a 45%, #8a6418 100%); box-shadow: 0 0 0 1px #4a3408, inset 0 0 0 2px rgba(255, 255, 255, .12); }
.coin::after { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; background: #4a3408; box-shadow: 0 0 0 1px #c9a14a; }
.gold { display: inline-flex; align-items: center; font-family: var(--font-h); color: var(--gold-hi); white-space: nowrap; }
.gold b { font-weight: 600; }
.gold small { margin-left: 3px; font-size: 12px; color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; font: 500 11px/1.3 var(--font-h); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 70%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--c) 14%, rgba(0, 0, 0, .3)); white-space: nowrap; }
.chip i { font-style: normal; font-size: 11px; }
.badge { padding: 1px 7px; font: 500 10.5px/1.5 var(--font-h); color: var(--muted); border: 1px solid rgba(201, 164, 92, .4); border-radius: 8px; white-space: nowrap; }
.badge-good { color: #9fe8a8; border-color: #4a8a5a; background: rgba(111, 224, 138, .1); }
.badge-gold { color: var(--gold-hi); border-color: var(--gold); background: rgba(201, 164, 92, .12); }
.badge-dim { opacity: .7; }
.sec-title { display: flex; align-items: baseline; gap: 4px; margin: 0 0 8px; padding-bottom: 4px; font: 600 14px var(--font-h); color: var(--gold); border-bottom: 1px solid rgba(201, 164, 92, .35); }
.sec-title::before { content: '◈'; margin-right: 3px; font-size: 11px; color: var(--verm-hi); }
.sec-title small { font-weight: 400; font-size: 12px; color: var(--muted); }
.sec-sub { margin: 10px 0 6px; font: 500 12.5px var(--font-h); color: var(--gold); letter-spacing: .4px; }
.empty-note { padding: 8px 0 14px; color: var(--dim); font-size: 13px; font-style: italic; }
.scroll-y { overflow-y: auto; overscroll-behavior: contain; }

/* ---------------------------------------------------------------- Tooltip / Popover / Modal */
.tooltip { position: fixed; left: -9999px; top: 0; max-width: 300px; padding: 8px 10px; pointer-events: none; font-size: 12.5px; color: var(--cream); background: linear-gradient(180deg, rgba(32, 25, 18, .98), rgba(15, 11, 8, .98)); border: 1px solid var(--gold); border-radius: 6px; box-shadow: 0 0 0 1px #000, 0 8px 24px rgba(0, 0, 0, .65); opacity: 0; transition: opacity .1s; }
.tooltip.show { opacity: 1; }
.tt-simple b { display: block; margin-bottom: 2px; font: 600 13.5px var(--font-h); color: var(--gold-hi); }
.tt-item { min-width: 210px; }
.tt-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid rgba(201, 164, 92, .3); }
.tt-icon { width: 40px; height: 40px; flex: none; image-rendering: pixelated; background: rgba(0, 0, 0, .45); border: 1px solid #3d3122; border-radius: 4px; }
.tt-name { font: 600 14.5px var(--font-h); }
.tt-type { font-size: 11.5px; color: var(--muted); }
.tt-stat { display: flex; align-items: baseline; gap: 8px; }
.tt-stat span { min-width: 64px; color: var(--muted); }
.tt-stat b { font: 500 13px var(--font-h); color: #9be89b; }
.tt-stat em { margin-left: auto; font: 500 11px var(--font-h); font-style: normal; }
.tt-stat em.up { color: var(--good); } .tt-stat em.down { color: var(--bad); }
.tt-cmp { font-size: 10.5px; color: var(--dim); text-align: right; }
.tt-req { margin-top: 4px; font-size: 12px; } .tt-req .ok { color: var(--muted); }
.tt-desc { margin-top: 6px; color: var(--text2); font-style: italic; }
.tt-dim { margin-top: 2px; font-size: 11.5px; color: var(--dim); }
.tt-price { display: flex; align-items: center; gap: 2px; margin-top: 6px; padding-top: 5px; border-top: 1px dashed rgba(201, 164, 92, .25); color: var(--muted); }
.tt-price b { margin-right: 3px; font: 600 13px var(--font-h); color: var(--gold-hi); }

.popover { position: fixed; pointer-events: auto; min-width: 170px; max-width: min(300px, calc(100vw - 12px)); padding: 8px; background: linear-gradient(180deg, #2a2017, #15100c); border: 1px solid var(--gold); border-radius: 6px; box-shadow: 0 0 0 1px #000, 0 10px 28px rgba(0, 0, 0, .7); animation: popin .12s ease-out; }
.ip-name { margin-bottom: 4px; font: 600 14px var(--font-h); }
.ip-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ip-acts .btn { flex: 1 1 auto; }
.player-menu { display: flex; flex-direction: column; gap: 4px; min-width: 190px; }
.pm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; padding-bottom: 6px; border-bottom: 1px solid rgba(201, 164, 92, .3); }
.pm-head .portrait-img { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--gold-lo); background: #1a120c; }
.pm-head b { display: block; font: 600 15px var(--font-h); color: var(--gold-hi); }
.pm-head small { font-size: 12px; color: var(--muted); }
.pm-item { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; font: 500 14px var(--font-h); color: var(--cream); text-align: left; background: rgba(255, 255, 255, .03); border: 1px solid transparent; border-radius: 4px; cursor: pointer; }
.pm-item:hover:not(:disabled) { border-color: var(--gold-lo); background: rgba(201, 164, 92, .12); }
.pm-item .ico { color: var(--gold); }
.pm-item:disabled { opacity: .5; cursor: default; }

.modal-back { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; pointer-events: auto; background: rgba(0, 0, 0, .55); animation: fadein .15s; }
.modal { width: min(400px, 100%); animation: popin .15s ease-out; }
.modal-body { padding: 16px 18px 4px; }
.modal-msg { margin: 0 0 10px; line-height: 1.6; color: var(--text2); }
.qty-row { display: flex; align-items: center; gap: 8px; }
.qty-row span { color: var(--muted); }
.qty-input { width: 100px; text-align: center; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px 14px; }

/* ---------------------------------------------------------------- ฉากหลังวูเซีย (login / create) */
.screen { position: fixed; inset: 0; overflow: hidden; pointer-events: auto; background: #0d0a12; user-select: none; }
.scenery { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.sky { position: absolute; inset: 0; background: linear-gradient(180deg, #100b1e 0%, #24163a 22%, #5a2442 42%, #b14a3a 58%, #ec9a4e 70%, #f8c97c 76%, #6a3040 88%, #1a0f14 100%); }
.stars { position: absolute; inset: 0 0 50% 0; opacity: .7; background-image:
  radial-gradient(1px 1px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 28% 8%, #fff, transparent), radial-gradient(1.5px 1.5px at 44% 22%, #ffe, transparent),
  radial-gradient(1px 1px at 63% 12%, #fff, transparent), radial-gradient(1px 1px at 78% 26%, #fff, transparent), radial-gradient(1.5px 1.5px at 88% 6%, #fff, transparent),
  radial-gradient(1px 1px at 6% 34%, #fff, transparent), radial-gradient(1px 1px at 52% 4%, #fff, transparent), radial-gradient(1px 1px at 94% 30%, #fff, transparent); animation: twinkle 4s ease-in-out infinite alternate; }
.sun { position: absolute; left: 66%; top: 52%; width: 26vmin; height: 26vmin; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, #fff6d0 0%, #ffd98a 42%, #f49a48 66%, rgba(244, 154, 72, 0) 71%); box-shadow: 0 0 120px 40px rgba(255, 160, 80, .35); }
.birds { position: absolute; left: 0; top: 26%; width: 100%; height: 60px; animation: birds 46s linear infinite; }
.birds i { position: absolute; width: 14px; height: 6px; }
.birds i::before, .birds i::after { content: ''; position: absolute; top: 0; width: 8px; height: 2px; background: #2a1420; border-radius: 2px; }
.birds i::before { left: 0; transform: rotate(22deg); transform-origin: right; animation: flap .5s ease-in-out infinite alternate; }
.birds i::after { right: 0; transform: rotate(-22deg); transform-origin: left; animation: flap2 .5s ease-in-out infinite alternate; }
.birds i:nth-child(1) { left: 10%; top: 10px; } .birds i:nth-child(2) { left: 13%; top: 24px; transform: scale(.8); } .birds i:nth-child(3) { left: 8%; top: 30px; transform: scale(.7); }
.mtn { position: absolute; left: 0; bottom: 0; width: 100%; }
.mtn-far { height: 50%; bottom: 20%; fill: #6a3a5a; opacity: .75; }
.mtn-mid { height: 46%; bottom: 7%; fill: #321d30; }
.mtn-mid .pagoda { fill: #1e1020; }
.mtn-near { height: 20%; fill: #100a0e; }
.mist { position: absolute; left: -30%; width: 160%; height: 16%; background: radial-gradient(ellipse 40% 50% at 30% 50%, rgba(255, 225, 225, .32), transparent 70%), radial-gradient(ellipse 35% 45% at 75% 55%, rgba(255, 230, 220, .26), transparent 70%); filter: blur(4px); animation: drift 28s ease-in-out infinite alternate; }
.mist-1 { bottom: 25%; }
.mist-2 { bottom: 8%; opacity: .8; animation-duration: 38s; animation-direction: alternate-reverse; }
.tree { position: absolute; left: 0; top: 0; width: clamp(240px, 42vmin, 460px); height: auto; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); }
.tree .trunk path { fill: none; stroke: #1c0e13; stroke-linecap: round; }
.tree .blossom circle { opacity: .9; }
.petals { position: absolute; inset: 0; }
.petals i { position: absolute; top: -4%; width: var(--sz); height: var(--sz); animation: fall linear infinite; }
.petals i b { display: block; width: 100%; height: 100%; border-radius: 100% 0 100% 0; background: radial-gradient(circle at 30% 30%, #fff0f5, #f5a3c0); animation: spin ease-in-out infinite alternate; }

/* ---------------------------------------------------------------- Login */
.login-center { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; height: 100%; padding: 16px; overflow-y: auto; }
.logo { position: relative; text-align: center; }
.logo-main span { display: inline-block; padding: 0 6px; font: 700 clamp(52px, 10vw, 108px)/1.12 var(--font-h); letter-spacing: 2px; color: transparent; background: linear-gradient(180deg, #fffae6 0%, #f6dc98 34%, #d2a855 58%, #8a6418 100%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 3px 0 #3a170c) drop-shadow(0 0 22px rgba(255, 170, 80, .45)); }
.logo-sub { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 2px; font: 500 clamp(15px, 2.4vw, 22px)/1 var(--font-h); letter-spacing: 12px; color: var(--cream); text-shadow: 0 2px 4px #000; }
.logo-sub span { margin-right: -12px; }
.logo-sub i { width: 64px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.logo-sub i:last-child { background: linear-gradient(90deg, var(--gold), transparent); }
.logo-seal { position: absolute; right: -30px; top: 6px; width: 46px; height: 46px; font: 34px/46px var(--font-cn); text-align: center; color: #ffeedd; background: #a8281e; border-radius: 6px; transform: rotate(8deg); box-shadow: inset 0 0 0 2px #ffd6b8, 0 4px 10px rgba(0, 0, 0, .5); }
.logo-tag { margin-top: 12px; font: 400 15px var(--font-b); letter-spacing: 1px; color: #f8e4c6; text-shadow: 0 1px 3px #000, 0 0 10px rgba(0, 0, 0, .6); }
/* โลโก้ภาษาอังกฤษ "Pranayut / Online" — ฟอนต์ Cinzel (ui/login.js โหลดเฉพาะตอนไม่ใช่ภาษาไทย) · ภาษาไทยใช้กฎด้านบนตามเดิม */
.logo-main span:lang(en) { font-family: 'Cinzel', var(--font-h); font-weight: 800; font-size: clamp(40px, 8vw, 92px); letter-spacing: 2px; }
.logo-sub span:lang(en) { font-family: 'Cinzel', var(--font-h); font-weight: 700; }
.login-panel { width: min(390px, 100%); padding-bottom: 12px; }
.login-form { display: flex; flex-direction: column; gap: 12px; padding: 18px 22px 8px; }
.field { display: flex; align-items: center; gap: 8px; padding: 0 10px; background: rgba(0, 0, 0, .45); border: 1px solid var(--gold-lo); border-radius: 4px; transition: border-color .15s; }
.field:focus-within { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201, 164, 92, .18); }
.field .ico { width: 18px; height: 18px; color: var(--gold); }
.field .input { padding-left: 0; background: transparent; border: 0; box-shadow: none; }
.login-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 2px; }
.login-agree { align-items: flex-start; line-height: 1.5; } .login-agree input { flex: none; margin-top: 2px; } .login-agree a { color: var(--gold-hi); text-decoration: underline; text-underline-offset: 2px; } .login-agree a, .login-foot a { white-space: nowrap; }
.form-err { display: none; padding: 6px 10px; font-size: 13px; color: #ffb4a8; background: rgba(142, 43, 43, .3); border-left: 3px solid var(--bad); border-radius: 2px; }
.form-err.show { display: block; }
.form-err.shake { animation: shake .35s; }
.form-hint { font-size: 12px; color: var(--dim); text-align: center; }
.login-status { padding: 0 16px; font-size: 12px; color: var(--muted); text-align: center; }
.login-status::before { content: '●'; margin-right: 6px; }
.login-status.on::before { color: #6fe08a; }
.login-status.off::before { color: #e0a040; animation: blink 1s infinite; }
.login-status.fail { color: var(--bad); cursor: pointer; text-decoration: underline; }
.login-status.fail::before { color: var(--bad); animation: none; }
.login-foot { position: absolute; left: 0; right: 0; bottom: calc(8px + var(--safe-b)); z-index: 2; font-size: 12px; text-align: center; color: rgba(243, 230, 200, .5); }
.login-foot a { color: var(--gold-hi, #f0d28a); text-decoration: none; } .login-foot a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- Create (เลือกธาตุ + รูปลักษณ์) */
.create-screen { overflow-y: auto; overscroll-behavior: contain; --elc: var(--gold); }
.create-screen .scenery { position: fixed; }
.create-screen .scenery::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 5, 10, .72), rgba(8, 5, 10, .5) 40%, rgba(8, 5, 10, .78)); }
.create-wrap { position: relative; z-index: 2; display: flex; flex-direction: column; justify-content: center; min-height: 100%; max-width: 1480px; margin: 0 auto; padding: 10px 16px 20px; }
.create-head { display: flex; align-items: center; justify-content: center; gap: 40px; margin-bottom: 10px; }
.ch-text h1 { margin: 0; font: 600 26px/1.2 var(--font-h); color: var(--gold-hi); text-shadow: 0 2px 6px #000; }
.ch-text p { margin: 2px 0 0; font-size: 13px; color: var(--text2); text-shadow: 0 1px 3px #000; }
.create-head .logo-sub { display: none; }
.logo-sm .logo-main span { font-size: 34px; }
.logo-sm .logo-sub { font-size: 11px; letter-spacing: 6px; }
.logo-sm .logo-sub span { margin-right: -6px; }
.logo-sm .logo-sub i { width: 28px; }
.logo-sm .logo-seal { right: -22px; top: 2px; width: 26px; height: 26px; font-size: 19px; line-height: 26px; border-radius: 4px; }
/* 3 คอลัมน์: ธาตุ | ค่าสถานะ | รูปลักษณ์+ชื่อ (จอเล็กลง: ค่าสถานะย้ายไปใต้ธาตุ / มือถือเรียงลงมา) */
.create-main { display: grid; grid-template-columns: minmax(0, 1fr) 312px 340px; grid-template-areas: 'left stats right'; gap: 14px; align-items: start; }
.create-left { grid-area: left; container: cleft / inline-size; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.create-stats { grid-area: stats; }
.create-right { grid-area: right; }
.copt-title { margin: 2px 0 8px; font: 600 15px var(--font-h); color: var(--gold); text-shadow: 0 1px 3px #000; }
.copt-title::before { content: '◈ '; color: var(--verm-hi); font-size: 11px; }
.copt-title small { font: 400 12.5px var(--font-b); color: var(--text2); }
.create-left > .copt-title { margin-bottom: -2px; }
.el-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.el-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; overflow: hidden; text-align: left; font-family: var(--font-b); color: var(--cream); background: radial-gradient(ellipse at 50% -20%, color-mix(in srgb, var(--c) 28%, transparent), transparent 65%), linear-gradient(180deg, rgba(32, 24, 18, .94), rgba(15, 11, 9, .96)); border: 1px solid color-mix(in srgb, var(--c) 30%, rgba(201, 164, 92, .3)); border-radius: 10px; cursor: pointer; transition: transform .18s, border-color .18s, box-shadow .18s; }
.el-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--c), transparent); opacity: .55; }
.el-card:hover { border-color: color-mix(in srgb, var(--c) 70%, #000); transform: translateY(-1px); }
.el-card.sel { border-color: var(--c); transform: translateY(-3px); box-shadow: 0 0 0 1px var(--c), 0 0 26px color-mix(in srgb, var(--c) 45%, transparent), 0 10px 26px rgba(0, 0, 0, .6); }
.el-card.sel::before { opacity: 1; height: 4px; }
.ec-head { display: flex; align-items: center; gap: 10px; }
.ec-emblem { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 38% 32%, color-mix(in srgb, var(--c) 70%, #fff 10%), color-mix(in srgb, var(--c) 30%, #120c08) 78%); border: 2px solid color-mix(in srgb, var(--c) 70%, #000); box-shadow: 0 0 0 2px rgba(0, 0, 0, .55), inset 0 -4px 8px rgba(0, 0, 0, .35); }
.ec-emblem i { font-style: normal; font-size: 23px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .6)); }
.el-card.sel .ec-emblem { animation: emb 2.4s ease-in-out infinite; }
.ec-names { min-width: 0; }
.ec-names b { display: block; font: 600 20px/1.15 var(--font-h); color: var(--c); text-shadow: 0 1px 2px #000; }
.ec-names small { font: 500 10.5px var(--font-h); letter-spacing: 3px; text-transform: uppercase; color: var(--muted); }
.ec-check { display: none; position: absolute; right: 8px; top: 9px; width: 22px; height: 22px; font: 700 13px/22px var(--font-h); text-align: center; color: #1a1008; background: var(--c); border-radius: 50%; box-shadow: 0 0 10px var(--c); }
.el-card.sel .ec-check { display: block; }
.ec-role { font: 500 13px var(--font-h); color: var(--text2); }
.ec-foot { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: auto; }
.ec-skills { display: flex; flex-wrap: wrap; align-items: center; gap: 0 3px; height: 22px; min-width: 0; overflow: hidden; }
.ec-skills .ec-sk { flex: none; width: 22px; height: 22px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .65); }
.ec-skills .ec-sk.sk-fb { font-size: 13px; }
.ec-skills em { margin-left: 2px; font: 500 11px/22px var(--font-h); font-style: normal; color: var(--muted); }
.ec-wpn { margin-left: auto; padding: 0 7px; font: 500 11px/18px var(--font-h); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-radius: 9px; background: rgba(0, 0, 0, .3); white-space: nowrap; }
.cd-panel { display: grid; grid-template-columns: minmax(0, 1fr) 214px; gap: 16px; padding: 12px 16px 14px; --c: var(--elc); }
.cd-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.cd-title i { font-style: normal; font-size: 22px; }
.cd-title b { font: 600 22px var(--font-h); }
.cd-title span { font: 500 14px var(--font-h); color: var(--text2); }
.cd-desc { margin: 4px 0 6px; font-size: 13.5px; line-height: 1.6; color: var(--text2); }
.cd-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; font-size: 12.5px; color: var(--muted); }
.cd-facts b { font: 600 13px var(--font-h); color: var(--cream); }
.cd-build { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px; cursor: help; }
.cd-build em { padding: 0 6px; font: 600 11.5px/18px var(--font-h); font-style: normal; color: var(--cream); background: rgba(0, 0, 0, .35); border: 1px solid rgba(201, 164, 92, .3); border-radius: 9px; }
.cd-build em small { font-weight: 400; color: var(--muted); }
.cd-note { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 5px 10px; font-size: 12.5px; color: var(--text2); background: linear-gradient(90deg, color-mix(in srgb, var(--elc) 16%, rgba(0, 0, 0, .3)), rgba(0, 0, 0, .15)); border-left: 3px solid var(--elc); border-radius: 0 4px 4px 0; }
.cd-note i { font-style: normal; font-size: 15px; color: var(--gold-hi); }
.cd-note b { font: 600 13px var(--font-h); color: var(--cream); }
.cd-sub { margin: 4px 0 6px; padding-bottom: 3px; font: 600 13px var(--font-h); color: var(--gold); border-bottom: 1px solid rgba(201, 164, 92, .2); }
.cd-sub small { font: 400 11.5px var(--font-b); color: var(--muted); }
.cs-skills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.cs-skill { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 4px 6px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(201, 164, 92, .18); border-radius: 6px; cursor: help; }
.cs-skill.start { border-color: color-mix(in srgb, var(--elc) 55%, transparent); background: color-mix(in srgb, var(--elc) 10%, rgba(0, 0, 0, .3)); }
.cs-sk-ico { flex: none; width: 30px; height: 30px; }
.cs-sk-main { min-width: 0; }
.cs-sk-main b { display: block; overflow: hidden; font: 500 12.5px/1.25 var(--font-h); white-space: nowrap; text-overflow: ellipsis; }
.cs-sk-main small { font: 400 10.5px var(--font-h); color: var(--muted); }
.cd-wheel { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wheel { position: relative; flex: none; width: 168px; height: 168px; }
.wheel-svg, .wheel-svg svg { width: 100%; height: 100%; display: block; }
.wh-ring { fill: none; stroke: rgba(201, 164, 92, .25); stroke-width: 1; stroke-dasharray: 3 4; }
.wh-core { fill: rgba(0, 0, 0, .55); stroke: rgba(201, 164, 92, .45); }
.wh-core-t { fill: var(--gold-hi); font: 600 13px var(--font-h); text-anchor: middle; }
.wh-core-s { fill: var(--muted); font: 500 9px var(--font-h); text-anchor: middle; }
.wh-arrow { fill: none; stroke: rgba(201, 164, 92, .45); stroke-width: 2.4; }
.wh-arrow.hot { stroke: #7fe08a; stroke-width: 3; }
.wh-arrow.cold { stroke: #ff7b6b; stroke-width: 3; }
.wh-node { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 50px; height: 50px; padding: 0; transform: translate(-50%, -50%); font: 500 12px/1.1 var(--font-h); color: var(--cream); background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--c) 42%, #222), #120d0a 80%); border: 2px solid color-mix(in srgb, var(--c) 55%, #000); border-radius: 50%; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.wh-node i { font-style: normal; font-size: 17px; line-height: 1.1; }
.wh-node:hover { transform: translate(-50%, -50%) scale(1.06); }
.wh-node.sel { transform: translate(-50%, -50%) scale(1.14); border-color: var(--c); box-shadow: 0 0 0 3px rgba(0, 0, 0, .6), 0 0 18px var(--c); }
.el-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 12px; width: 100%; padding-bottom: 5px; border-bottom: 1px dashed rgba(201, 164, 92, .25); color: var(--muted); font-size: 12px; }
.el-rules b { font-family: var(--font-h); font-weight: 600; }
.el-info { width: 100%; font-size: 12px; line-height: 1.5; }
.el-info .good { color: var(--good); } .el-info .bad { color: var(--bad); } .el-info .dim { font-size: 12px; }
.create-right { display: flex; flex-direction: column; gap: 7px; padding: 12px 16px 16px; }
.create-right .copt-title { margin: 0; }
.create-right .copt-title.mt { margin-top: 6px; }
.cp-stage { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 196px; margin-bottom: 2px; overflow: hidden; border: 1px solid rgba(201, 164, 92, .25); border-radius: 8px; background: radial-gradient(ellipse at 50% 85%, color-mix(in srgb, var(--elc) 30%, transparent), transparent 60%), linear-gradient(180deg, rgba(0, 0, 0, .1), rgba(0, 0, 0, .45)); }
.cp-glow { position: absolute; left: 50%; top: 42%; width: 150px; height: 150px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--elc) 25%, transparent), transparent 70%); animation: pulse 3s ease-in-out infinite; }
.cp-ring { position: absolute; left: 50%; bottom: 16px; width: 120px; height: 26px; transform: translateX(-50%); border: 1px solid color-mix(in srgb, var(--elc) 70%, transparent); border-radius: 50%; box-shadow: 0 0 16px color-mix(in srgb, var(--elc) 50%, transparent); animation: ring 2s ease-in-out infinite; }
.cp-canvas { position: relative; width: 192px; height: 180px; image-rendering: pixelated; image-rendering: crisp-edges; }
.cp-sum { position: absolute; left: 8px; top: 7px; display: flex; flex-direction: column; font-size: 11.5px; color: var(--muted); text-shadow: 0 1px 2px #000; }
.cp-sum i { font-style: normal; font-size: 18px; }
.cp-sum b { font: 600 15px var(--font-h); color: var(--elc); }
.cr-row { display: grid; grid-template-columns: 54px 1fr; align-items: center; gap: 8px; }
.cr-row > label { font: 500 13px var(--font-h); color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg.seg4 { grid-template-columns: repeat(4, 1fr); }
.seg-btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 4px; font: 500 15px var(--font-h); color: var(--muted); background: rgba(0, 0, 0, .35); border: 1px solid var(--gold-lo); border-radius: 5px; cursor: pointer; }
.seg-btn i { font-style: normal; font-size: 16px; }
.seg-btn:hover { color: var(--cream); border-color: var(--gold); }
.seg-btn.sel { color: #fff; background: linear-gradient(180deg, #a83a2e, #6e1e1e); border-color: var(--gold); }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.swatch { position: relative; width: 36px; height: 36px; padding: 0; overflow: hidden; border: 2px solid #000; border-radius: 50%; cursor: pointer; background: conic-gradient(var(--a) 0 50%, var(--b) 50% 75%, var(--d) 75%); box-shadow: 0 0 0 1px var(--gold-lo); transition: transform .12s, box-shadow .12s; }
.swatches .swatch:hover { transform: scale(1.07); }
.swatch.sel { box-shadow: 0 0 0 2px var(--gold-hi), 0 0 12px rgba(240, 210, 138, .7); transform: scale(1.08); }
.swatch.sel::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; font: 700 15px var(--font-h); color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.swatch.el-outfit::before { content: '★'; position: absolute; right: 3px; top: 0; font-size: 10px; color: #ffe27a; text-shadow: 0 0 2px #000; }
.name-input { font-size: 16px; }
.name-hint { margin-top: -3px; font-size: 11.5px; color: var(--dim); }
.create-ok { width: 100%; margin-top: 2px; }
.cr-sum { display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.cr-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
.cr-stats span { display: flex; flex-direction: column; align-items: center; padding: 2px 0 1px; font: 600 14px/1.1 var(--font-h); color: var(--cream); background: rgba(0, 0, 0, .35); border: 1px solid rgba(201, 164, 92, .2); border-radius: 4px; }
.cr-stats small { font: 500 9.5px/1.2 var(--font-h); letter-spacing: .4px; color: var(--muted); }
.cr-stats .up { color: var(--good); border-color: rgba(127, 224, 138, .35); }
.cr-stats .down { color: var(--bad); border-color: rgba(255, 123, 107, .35); }
.cr-left { font-size: 11.5px; text-align: center; color: var(--good); }
.cr-left.has { color: var(--warn); }

/* แผงแจกค่าสถานะ (− ค่า + พร้อมแต้มคงเหลือ) */
.create-stats { container: cstats / inline-size; display: flex; flex-direction: column; gap: 7px; padding: 12px 14px 14px; --c: var(--elc); }
.ca-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ca-head .copt-title { margin: 0; }
.ca-pool { display: flex; align-items: center; gap: 8px; padding: 3px 4px 3px 12px; background: rgba(0, 0, 0, .4); border: 1px solid var(--gold-lo); border-radius: 18px; }
.ca-pool span { font: 500 12.5px var(--font-h); color: var(--muted); white-space: nowrap; }
.ca-pool b { min-width: 34px; padding: 0 6px; font: 700 18px/28px var(--font-h); text-align: center; color: var(--good); background: rgba(0, 0, 0, .45); border-radius: 14px; }
.ca-pool.has { border-color: var(--gold); animation: glow 2s ease-in-out infinite; }
.ca-pool.has span { color: var(--cream); }
.ca-pool.has b { color: #2a1a08; background: linear-gradient(180deg, #ffe9b0, #d6a446); text-shadow: 0 1px 0 rgba(255, 255, 255, .4); }
.ca-pool.flash { animation: shake .35s; }
.ca-hint { margin-top: -3px; font-size: 11.5px; line-height: 1.45; color: var(--dim); }
.ca-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.ca-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ca-rows { display: flex; flex-direction: column; gap: 4px; }
.ca-row { display: grid; grid-template-columns: minmax(0, 1fr) 32px 38px 32px; align-items: center; gap: 4px; padding: 3px 4px 3px 9px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(201, 164, 92, .16); border-radius: 6px; transition: border-color .15s, background .15s; }
.ca-row:hover { background: rgba(201, 164, 92, .07); }
.ca-row.up { border-color: rgba(127, 224, 138, .32); }
.ca-row.down { border-color: rgba(255, 123, 107, .32); }
.ca-name { min-width: 0; cursor: help; }
.ca-label { display: flex; align-items: baseline; gap: 6px; overflow: hidden; white-space: nowrap; }
.ca-label b { font: 500 13.5px/1.25 var(--font-h); color: var(--cream); }
.ca-label small { font: 600 10.5px var(--font-h); letter-spacing: .6px; color: var(--gold); }
.ca-bar { position: relative; height: 5px; margin: 3px 4px 2px 0; overflow: hidden; background: rgba(0, 0, 0, .65); border-radius: 3px; box-shadow: 0 0 0 1px rgba(201, 164, 92, .14); }
.ca-bar i { position: absolute; top: 0; bottom: 0; left: 0; transition: width .12s, left .12s; }
.ca-bar .cb-fill { background: linear-gradient(90deg, #6e5732, var(--gold)); }
.ca-bar .cb-up { background: linear-gradient(90deg, #3f8d58, #8fe08f); box-shadow: 0 0 6px rgba(143, 224, 143, .6); }
.ca-bar .cb-down { background: repeating-linear-gradient(135deg, rgba(255, 123, 107, .6) 0 3px, rgba(255, 123, 107, .15) 3px 6px); }
.ca-bar .cb-mark { width: 1px; background: rgba(255, 243, 210, .55); }
.ca-btn { display: grid; place-items: center; width: 32px; height: 32px; padding: 0 0 2px; font: 700 19px/1 var(--font-h); color: #fff; border: 1px solid var(--gold); border-radius: 6px; cursor: pointer; touch-action: manipulation; -webkit-touch-callout: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .14); transition: filter .1s, transform .06s; }
.ca-btn.plus { background: radial-gradient(circle at 40% 30%, #cc4e3c, #6a1c1c); }
.ca-btn.minus { color: var(--cream); background: radial-gradient(circle at 40% 30%, #5a4632, #231a13); border-color: var(--gold-lo); }
.ca-btn:hover:not(:disabled) { filter: brightness(1.2); }
.ca-btn.plus:hover:not(:disabled) { box-shadow: 0 0 10px rgba(255, 120, 80, .45); }
.ca-btn.minus:hover:not(:disabled) { border-color: var(--gold); }
.ca-btn:active:not(:disabled), .ca-btn.held { transform: translateY(1px) scale(.95); filter: brightness(1.3); }
.ca-btn:disabled { color: #5a4d3c; background: #221b14; border-color: #3e3326; cursor: default; box-shadow: none; }
.ca-val { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ca-val b { font: 600 19px/1.05 var(--font-h); color: var(--cream); }
.ca-val small { height: 11px; font: 600 10px/11px var(--font-h); }
.ca-row.up .ca-val b, .ca-row.up .ca-val small { color: var(--good); }
.ca-row.down .ca-val b, .ca-row.down .ca-val small { color: var(--bad); }
.ca-sub { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 2px; padding-bottom: 2px; font: 600 12.5px var(--font-h); color: var(--gold); border-bottom: 1px solid rgba(201, 164, 92, .2); }
.ca-sub small { font: 400 11px var(--font-h); color: var(--muted); white-space: nowrap; }
.ca-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.ca-preset { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 40px; padding: 2px 4px; line-height: 1.2; color: var(--text2); background: rgba(0, 0, 0, .35); border: 1px solid var(--gold-lo); border-radius: 6px; cursor: pointer; touch-action: manipulation; transition: border-color .15s, background .15s; }
.ca-preset b { max-width: 100%; overflow: hidden; font: 500 13px var(--font-h); color: var(--cream); white-space: nowrap; text-overflow: ellipsis; }
.ca-preset small { max-width: 100%; overflow: hidden; font: 400 10px var(--font-h); color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.ca-preset:hover:not(:disabled) { border-color: var(--gold); background: rgba(201, 164, 92, .1); }
.ca-preset.rec { border-color: color-mix(in srgb, var(--elc) 65%, var(--gold-lo)); background: color-mix(in srgb, var(--elc) 12%, rgba(0, 0, 0, .35)); }
.ca-preset.on { background: linear-gradient(180deg, #a83a2e, #6e1e1e); border-color: var(--gold-hi); box-shadow: 0 0 10px rgba(201, 164, 92, .3); }
.ca-preset.on small { color: #f3d9b0; }
.ca-preset:disabled { opacity: .4; cursor: default; }
.ca-btn:focus-visible, .ca-preset:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 1px; }
.ca-star { display: none; position: absolute; right: 4px; top: 1px; font: normal 11px/1 var(--font-h); color: #ffe27a; text-shadow: 0 0 4px rgba(255, 200, 80, .9), 0 1px 1px #000; }
.ca-preset.suit .ca-star { display: block; }
.ca-dv { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 6px; }
.ca-dv > div { display: flex; align-items: baseline; gap: 4px; min-width: 0; padding: 3px 7px; background: rgba(255, 255, 255, .035); border-radius: 3px; cursor: help; }
.ca-dv span { font: 500 11.5px var(--font-h); color: var(--muted); white-space: nowrap; }
.ca-dv b { margin-left: auto; font: 600 13px var(--font-h); color: var(--cream); }
.ca-dv em { min-width: 28px; font: 500 10.5px var(--font-h); font-style: normal; text-align: right; color: var(--dim); }
.ca-dv .up em { color: var(--good); }
.ca-dv .down em { color: var(--bad); }
.ca-dv .hp b { color: #ff9f8c; }
.ca-dv .sp b { color: #9fdcff; }
@container cstats (min-width: 600px) {
  .ca-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
}
@media (pointer: coarse) {
  .ca-row { grid-template-columns: minmax(0, 1fr) 40px 40px 40px; }
  .ca-btn { width: 40px; height: 40px; }
  .ca-preset { min-height: 44px; }
}
/* คอลัมน์ธาตุแคบ (3 คอลัมน์บนแล็ปท็อป): การ์ดกระชับขึ้น สกิลเรียง 2 คอลัมน์ */
@container cleft (max-width: 720px) {
  .el-card { padding: 9px 10px 10px; gap: 5px; }
  .ec-emblem { width: 40px; height: 40px; }
  .ec-emblem i { font-size: 20px; }
  .ec-head { gap: 8px; }
  .ec-names b { font-size: 18px; }
  .ec-names small { letter-spacing: 2px; }
  .ec-role { font-size: 12px; }
  .cs-skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container cleft (max-width: 600px) {
  .el-card { padding: 8px 8px 9px; }
  .ec-emblem { width: 36px; height: 36px; }
  .ec-emblem i { font-size: 18px; }
  .ec-names b { font-size: 17px; }
  .ec-check { right: 5px; top: 5px; width: 18px; height: 18px; font-size: 11px; line-height: 18px; }
  .cd-panel { grid-template-columns: minmax(0, 1fr) 190px; gap: 12px; }
  .wheel { width: 156px; height: 156px; }
}
@container cleft (max-width: 540px) {
  .el-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cd-panel { grid-template-columns: 1fr; }
  .cd-wheel { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 16px; }
  .cd-wheel .el-rules, .cd-wheel .el-info { width: auto; flex: 1; min-width: 180px; }
}

/* ---------------------------------------------------------------- HUD */
.hud { position: fixed; inset: 0; pointer-events: none; }
.hud-left { position: absolute; left: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; width: 300px; }
.hud-char { pointer-events: auto; display: flex; gap: 10px; padding: 8px 10px 8px 8px; }
.hud-port-wrap { position: relative; flex: none; align-self: center; }
.hud-portrait { display: block; width: 66px; height: 66px; padding: 0; overflow: hidden; border: 2px solid var(--gold); border-radius: 50%; cursor: pointer; background: radial-gradient(circle at 50% 30%, #5a4632, #1a120c); box-shadow: 0 0 0 2px #000, 0 0 0 3px var(--gold-lo), 0 0 12px rgba(0, 0, 0, .6); }
.hud-portrait:hover { box-shadow: 0 0 0 2px #000, 0 0 0 3px var(--gold), 0 0 14px rgba(240, 210, 138, .5); }
.hud-portrait .portrait-img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.portrait-fb { display: grid; place-items: center; font-size: 28px; }
.hud-lv { position: absolute; left: 50%; bottom: -5px; min-width: 30px; padding: 2px 7px; transform: translateX(-50%); font: 600 12px/1.2 var(--font-h); text-align: center; color: #fff; background: linear-gradient(180deg, #b63c2f, #6a1c1c); border: 1px solid var(--gold); border-radius: 9px; text-shadow: 0 1px 1px #000; }
.hud-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.hud-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hud-name { overflow: hidden; font: 600 15.5px/1.25 var(--font-h); white-space: nowrap; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.hud-chips { display: flex; gap: 4px; margin-left: auto; }
.hud-bottom { display: flex; align-items: center; gap: 6px; min-height: 20px; font-size: 13px; }
.hud-gold .gold small { display: none; }
.hud-pts { pointer-events: auto; margin-left: auto; padding: 1px 8px; font: 500 11px/1.5 var(--font-h); color: #fff; background: linear-gradient(180deg, #b63c2f, #761f1f); border: 1px solid var(--gold); border-radius: 10px; cursor: pointer; animation: pulse 1.6s infinite; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.hud-map { position: absolute; left: 50%; top: 8px; min-width: 220px; padding: 4px 40px 6px; transform: translateX(-50%); text-align: center; background: linear-gradient(90deg, transparent, rgba(20, 15, 11, .88) 18%, rgba(20, 15, 11, .88) 82%, transparent); }
.hud-map::before, .hud-map::after { content: ''; position: absolute; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.hud-map::before { top: 0; } .hud-map::after { bottom: 0; }
.map-name { font: 600 18px/1.25 var(--font-h); letter-spacing: 1px; color: var(--gold-hi); text-shadow: 0 2px 4px #000; white-space: nowrap; }
.map-sub { font: 400 12px/1.3 var(--font-h); color: var(--muted); }
.map-sub.safe, .hud-map-m .safe { color: #8fe0b0; } .map-sub.danger, .hud-map-m .danger { color: var(--bad); } .map-sub.easy, .hud-map-m .easy { color: var(--dim); }
.map-orn { position: absolute; top: 50%; left: 14px; width: 8px; height: 8px; transform: translateY(-50%) rotate(45deg); border: 1px solid var(--gold); background: var(--verm); }
.map-orn.r { left: auto; right: 14px; }
.hud-map-m { display: none; }
.hud-quests { pointer-events: auto; max-height: 38vh; overflow-y: auto; padding: 4px 10px 6px; font-size: 12.5px; }
.hud-quests.collapsed { width: max-content; min-width: 120px; }
.hq-head, .hp-head { all: unset; display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 0; font: 600 13px var(--font-h); color: var(--gold); cursor: pointer; box-sizing: border-box; }
.hq-head .ico, .hp-head .ico { width: 16px; height: 16px; }
.hq-head em, .hp-head em { padding: 0 6px; font: 500 11px/1.5 var(--font-h); font-style: normal; color: #fff; background: var(--verm); border-radius: 8px; }
.hp-head em { background: rgba(201, 164, 92, .2); color: var(--gold-hi); }
.hq-tog { margin-left: auto; opacity: .7; }
.hq-item { padding: 4px 0 3px; border-top: 1px dashed rgba(201, 164, 92, .2); cursor: pointer; }
.hq-item:hover .hq-name { color: var(--gold-hi); }
.hq-name { font-weight: 600; color: var(--cream); text-shadow: 0 1px 1px #000; }
.hq-next .hq-name { font-weight: 400; color: var(--muted); }
.hq-next .hq-name b { color: var(--cream); }
.hq-line { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.hq-line b { margin-left: auto; font: 500 12px var(--font-h); color: var(--cream); }
.hq-line.ok { color: var(--good); } .hq-line.ok b { color: var(--good); }
.hq-line.ready { color: var(--good); font-weight: 600; }
.hq-line .ico { width: 14px; height: 14px; }
.hq-mon { width: 20px; height: 20px; image-rendering: pixelated; flex: none; }
.hq-empty { padding: 3px 0; color: var(--dim); font-style: italic; }
.hud-party { position: absolute; right: 10px; top: 220px; width: 196px; pointer-events: auto; padding: 4px 8px 6px; }
.hp-mem { display: flex; align-items: center; gap: 8px; padding: 5px 0 4px; border-top: 1px dashed rgba(201, 164, 92, .2); }
.hp-port { position: relative; flex: none; width: 32px; height: 32px; }
.hp-port .portrait-img { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--gold-lo); background: #1a120c; image-rendering: pixelated; object-fit: cover; }
.crown { position: absolute; top: -9px; left: -5px; width: 16px; height: 16px; color: #ffd84a; transform: rotate(-22deg); filter: drop-shadow(0 1px 1px #000); }
.hp-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.hp-name { display: flex; align-items: baseline; gap: 4px; font: 500 12.5px/1.2 var(--font-h); }
.hp-name span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hp-name small { margin-left: auto; color: var(--muted); font-size: 11px; }
.hp-mem.me .hp-name span { color: var(--gold-hi); }
.hud-menu { position: absolute; right: 8px; bottom: calc(8px + var(--safe-b)); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.hud-online { padding-right: 4px; font: 400 11.5px var(--font-h); color: var(--muted); text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.hud-online::before { content: '●'; margin-right: 5px; color: #6fe08a; }
.menu-btns { pointer-events: auto; display: flex; gap: 4px; padding: 5px; background: rgba(18, 14, 10, .82); border: 1px solid rgba(201, 164, 92, .5); border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .5); }
.menu-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 58px; height: 56px; padding: 0; color: var(--gold); background: linear-gradient(180deg, #30251b, #18120d); border: 1px solid var(--gold-lo); border-radius: 6px; cursor: pointer; transition: border-color .15s, box-shadow .15s, color .15s; }
.menu-btn .ico { width: 24px; height: 24px; }
.mb-label { font: 500 12px/1 var(--font-h); color: var(--cream); }
.menu-btn kbd { position: absolute; top: 2px; right: 4px; font: 600 9px var(--font-h); color: var(--dim); }
.menu-btn:hover { color: var(--gold-hi); border-color: var(--gold); box-shadow: 0 0 10px rgba(201, 164, 92, .4); }
.menu-btn.active { color: #fff; background: linear-gradient(180deg, #7e2a22, #4a1717); border-color: var(--gold); }
.menu-btn.notify::after { content: ''; position: absolute; top: 4px; left: 4px; width: 8px; height: 8px; border-radius: 50%; background: #ff5a3a; box-shadow: 0 0 6px #ff5a3a; animation: pulse 1.2s infinite; }

/* HUD v0.2 */
.hud-char { --elc: var(--gold); border-left: 3px solid var(--elc); }
.hud-portrait { border-color: var(--elc); }
.hud-lv { min-width: 40px; white-space: nowrap; }
.hud-top { gap: 5px; }
.hud-el { display: grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--elc) 65%, #fff 5%), color-mix(in srgb, var(--elc) 25%, #000) 80%); border: 1px solid var(--elc); box-shadow: 0 0 6px color-mix(in srgb, var(--elc) 60%, transparent); }
.hud-el i { font-style: normal; font-size: 11px; line-height: 1; }
.hud-name { color: var(--cream); }
.hud-pts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px; margin-left: auto; min-width: 0; padding: 0; background: none; border: 0; animation: none; max-width: none; overflow: visible; }
.pts-chip { pointer-events: auto; padding: 1px 7px; font: 500 11px/1.5 var(--font-h); color: #fff; background: linear-gradient(180deg, #b63c2f, #761f1f); border: 1px solid var(--gold); border-radius: 10px; cursor: pointer; white-space: nowrap; animation: glowR 1.6s ease-in-out infinite; }
.pts-chip.sk { background: linear-gradient(180deg, #3f6fb8, #1f3a7a); border-color: #9fc8ff; animation-name: glowB; }
.mb-badge { position: absolute; top: -7px; left: -7px; min-width: 19px; height: 19px; padding: 0 5px; font: 700 11px/19px var(--font-h); font-style: normal; text-align: center; color: #fff; background: #d8402c; border: 1px solid #ffd27a; border-radius: 10px; box-shadow: 0 0 0 2px rgba(0, 0, 0, .6), 0 0 8px #ff5a3a; animation: badgePulse 1.2s ease-in-out infinite; }
.menu-btn[data-tab=skill] .mb-badge { background: #2f6fd0; box-shadow: 0 0 0 2px rgba(0, 0, 0, .6), 0 0 8px #4a9aff; }
.menu-btn.notify::after { display: none; }
.menu-btn.notify { border-color: var(--gold); }
.hud-online { display: flex; align-items: center; gap: 8px; }
.hud-online::before { display: none; }
.hud-online-n::before { content: '●'; margin-right: 5px; color: #6fe08a; }
.hud-logout { pointer-events: auto; display: inline-flex; align-items: center; gap: 4px; min-height: 26px; padding: 0 9px; font: 500 11.5px var(--font-h); color: var(--muted); background: rgba(18, 14, 10, .8); border: 1px solid rgba(201, 164, 92, .35); border-radius: 13px; cursor: pointer; text-shadow: none; }
.hud-logout .ico { width: 14px; height: 14px; color: var(--gold); }
.hud-logout:hover { color: #fff; border-color: var(--verm-hi); background: rgba(110, 30, 30, .85); }
.hp-head { display: flex; align-items: center; gap: 2px; }
.hp-title { all: unset; display: flex; flex: 1; align-items: center; gap: 6px; padding: 3px 0; font: 600 13px var(--font-h); color: var(--gold); cursor: pointer; box-sizing: border-box; }
.hp-title .ico { width: 16px; height: 16px; }
.hp-title em { padding: 0 6px; font: 500 11px/1.5 var(--font-h); font-style: normal; color: var(--gold-hi); background: rgba(201, 164, 92, .2); border-radius: 8px; }
.hp-tog { display: grid; place-items: center; width: 26px; height: 24px; padding: 0; color: var(--gold); background: none; border: 0; cursor: pointer; opacity: .8; }
.hp-tog .ico { width: 15px; height: 15px; }
.hud-party.collapsed { width: auto; min-width: 130px; }
.hp-mem.down { filter: grayscale(.9); opacity: .7; }
.hp-port .portrait-img { border-color: var(--elc); }
.hp-el { font-style: normal; font-size: 11px; }
.hud-quests .hq-item.ready { background: linear-gradient(90deg, rgba(111, 224, 138, .1), transparent); }

/* เพิ่มเติม v0.2 */
.tooltip { white-space: pre-line; }
.tt-gain { margin-top: 5px; padding-top: 4px; border-top: 1px dashed rgba(201, 164, 92, .25); font-size: 12px; color: #9be89b; }
.tt-weapon { margin-top: 4px; font-size: 12px; color: #ffd98a; }
.win-tab .tab-badge { position: absolute; top: 2px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; font: 700 10.5px/17px var(--font-h); font-style: normal; color: #fff; background: #d8402c; border-radius: 9px; box-shadow: 0 0 6px #ff5a3a; animation: badgePulse 1.2s ease-in-out infinite; }
.dv-row small { font-size: 10.5px; color: var(--dim); }
.dv-note { margin-top: 10px; font-size: 11.5px; color: var(--dim); }
.big-portrait { border-color: var(--elc, var(--gold)); }
.st-name { color: var(--cream); }
.pts-box > div { display: flex; flex-direction: column; }
.pts-box small { font-size: 11px; color: var(--dim); }
.pts-box.has small { color: var(--gold-hi); }
.inv-note { margin-top: 8px; font-size: 11.5px; line-height: 1.5; color: var(--dim); }
.qc-rw { margin: -2px 0 4px; padding: 0 12px 8px; }
.qc-rw .sec-sub { display: block; margin: 6px 0 4px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.fchip { min-height: 30px; padding: 2px 11px; font: 500 12.5px var(--font-h); color: var(--muted); background: rgba(0, 0, 0, .35); border: 1px solid rgba(201, 164, 92, .3); border-radius: 15px; cursor: pointer; }
.fchip:hover { color: var(--cream); border-color: var(--gold); }
.fchip.active { color: #fff; background: linear-gradient(180deg, #a83a2e, #6e1e1e); border-color: var(--gold); }
b.free { color: var(--good); font-family: var(--font-h); }
@keyframes emb { 0%, 100% { box-shadow: 0 0 0 2px rgba(0, 0, 0, .55), 0 0 8px color-mix(in srgb, var(--c) 40%, transparent); } 50% { box-shadow: 0 0 0 2px rgba(0, 0, 0, .55), 0 0 20px var(--c); } }
@keyframes glowR { 0%, 100% { box-shadow: 0 0 0 rgba(255, 90, 58, 0); } 50% { box-shadow: 0 0 10px rgba(255, 90, 58, .8); } }
@keyframes glowB { 0%, 100% { box-shadow: 0 0 0 rgba(90, 160, 255, 0); } 50% { box-shadow: 0 0 10px rgba(90, 160, 255, .85); } }
@keyframes badgePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
@keyframes canGlow { 0%, 100% { box-shadow: 0 0 0 rgba(255, 210, 122, 0); } 50% { box-shadow: 0 0 12px rgba(255, 210, 122, .55); } }

/* ---------------------------------------------------------------- Chat */
.chat { position: absolute; left: 8px; bottom: calc(8px + var(--safe-b)); display: flex; flex-direction: column; width: min(410px, calc(100vw - 16px)); pointer-events: auto; background: rgba(12, 9, 7, .55); border: 1px solid rgba(201, 164, 92, .32); border-radius: 6px; transition: background .2s, border-color .2s; }
.chat:hover, .chat.focus { background: rgba(12, 9, 7, .86); border-color: rgba(201, 164, 92, .6); }
.chat-head { display: flex; align-items: center; gap: 3px; padding: 3px 4px; border-bottom: 1px solid rgba(201, 164, 92, .2); }
.chat-toggle, .chat-min { position: relative; display: grid; place-items: center; width: 30px; height: 28px; padding: 0; color: var(--gold); background: none; border: 0; border-radius: 4px; cursor: pointer; }
.chat-toggle .ico, .chat-min .ico { width: 17px; height: 17px; }
.chat-min { margin-left: auto; }
.chat.collapsed .chat-min .ico { transform: rotate(180deg); }
.chat-unread { position: absolute; top: -4px; right: -6px; min-width: 16px; padding: 0 4px; font: 600 10px/16px var(--font-h); color: #fff; background: var(--verm-hi); border-radius: 8px; }
.chat-tabs { display: flex; gap: 2px; }
.chat-tab { min-height: 28px; padding: 2px 11px; font: 500 12.5px var(--font-h); color: var(--muted); background: none; border: 1px solid transparent; border-radius: 4px; cursor: pointer; }
.chat-tab:hover { color: var(--cream); }
.chat-tab.active { color: #f3efe6; background: rgba(201, 164, 92, .12); border-color: var(--gold-lo); }
.chat-tab.active[data-ch=world] { color: #ffd76a; } .chat-tab.active[data-ch=party] { color: #7fe08a; }
.chat-log { height: 168px; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px; font-size: 13px; line-height: 1.5; user-select: text; -webkit-user-select: text; }
.msg { word-break: break-word; text-shadow: 0 1px 1px #000, 0 0 2px rgba(0, 0, 0, .8); }
.msg .tag { margin-right: 4px; font: 500 11px var(--font-h); opacity: .85; }
.msg .from { font-weight: 700; cursor: pointer; }
.msg .from:hover { text-decoration: underline; }
.ch-map { color: #f4f0e8; } .ch-world { color: #ffd76a; } .ch-party { color: #7fe08a; } .ch-whisper { color: #ff9ad5; } .ch-system { color: #ffa04a; }
.chat-form { display: flex; gap: 4px; padding: 4px; border-top: 1px solid rgba(201, 164, 92, .2); }
.chat-ch { flex: none; min-width: 54px; min-height: 32px; font: 500 12px var(--font-h); color: #f4f0e8; background: rgba(0, 0, 0, .45); border: 1px solid var(--gold-lo); border-radius: 4px; cursor: pointer; }
.chat-ch[data-ch=world] { color: #ffd76a; } .chat-ch[data-ch=party] { color: #7fe08a; }
/* โทรโข่งที่เหลือ (แชทโลก · ui/chat.js) — หมด = แดง */
.chat-mega { flex: none; align-self: center; padding: 2px 6px; font: 700 12px var(--font-h); color: #ffe7a8; background: rgba(120, 70, 10, .45); border: 1px solid rgba(255, 215, 106, .5); border-radius: 10px; white-space: nowrap; }
.chat-mega.none { color: #ffb4a4; background: rgba(120, 20, 20, .5); border-color: rgba(255, 120, 100, .55); }
.chat-mega.hidden { display: none; }
.chat-input { flex: 1; min-width: 0; min-height: 32px; padding: 5px 8px; font: 13px var(--font-b); color: var(--cream); background: rgba(0, 0, 0, .45); border: 1px solid rgba(201, 164, 92, .3); border-radius: 4px; outline: none; }
.chat-input:focus { border-color: var(--gold); }
.chat-input::placeholder { color: #7d6f58; }
.chat-send { flex: none; min-width: 44px; min-height: 32px; font: 500 12.5px var(--font-h); color: var(--cream); background: linear-gradient(180deg, #3b2e22, #231a13); border: 1px solid var(--gold-lo); border-radius: 4px; cursor: pointer; }
.chat.collapsed { width: auto; background: rgba(12, 9, 7, .75); }
.chat.collapsed .chat-log, .chat.collapsed .chat-form { display: none; }
.chat.collapsed .chat-head { border-bottom: 0; }
.chat.in-battle:not(.collapsed) { width: min(340px, calc(100vw - 16px)); }
.chat.in-battle .chat-log { height: 120px; }

/* ---------------------------------------------------------------- หน้าต่าง */
.window { position: fixed; left: 50%; top: 50%; display: flex; flex-direction: column; transform: translate(-50%, -50%); pointer-events: auto; }
.window.dragged { transform: none; }
.window.pop-in { animation: winin .18s ease-out; }
.win-head { display: flex; flex: none; align-items: center; height: 42px; padding: 0 6px 0 42px; cursor: move; background: linear-gradient(180deg, #742222, #461414); border-bottom: 1px solid var(--gold); border-radius: var(--r) var(--r) 0 0; }
.win-title { flex: 1; font: 600 16px var(--font-h); text-align: center; letter-spacing: 1px; color: var(--gold-hi); text-shadow: 0 1px 2px #000; }
.win-close { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; color: var(--gold); background: rgba(0, 0, 0, .3); border: 1px solid var(--gold-lo); border-radius: 4px; cursor: pointer; }
.win-close:hover { color: #fff; border-color: var(--gold); background: rgba(0, 0, 0, .5); }
.win-close .ico { width: 18px; height: 18px; }
.win-tabs { display: flex; flex: none; gap: 3px; padding: 7px 10px 0; background: rgba(0, 0, 0, .25); border-bottom: 1px solid var(--gold-lo); }
.win-tab { position: relative; display: flex; flex: 1; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 6px 4px; font: 500 14px var(--font-h); color: var(--muted); background: linear-gradient(180deg, #251c15, #18120e); border: 1px solid rgba(201, 164, 92, .25); border-bottom: 0; border-radius: 6px 6px 0 0; cursor: pointer; }
.win-tab .ico { width: 17px; height: 17px; color: var(--gold-lo); }
.win-tab:hover { color: var(--cream); }
.win-tab.active { margin-bottom: -1px; color: var(--gold-hi); background: linear-gradient(180deg, #3d2c1f, #1f1813); border-color: var(--gold); }
.win-tab.active .ico { color: var(--gold); }
.win-tab kbd { padding: 0 3px; font: 600 9px/1.4 var(--font-h); color: var(--dim); border: 1px solid rgba(201, 164, 92, .25); border-radius: 3px; }
.win-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px; }
.char-win { width: min(940px, calc(100vw - 24px)); height: min(620px, calc(100vh - 80px)); }
.cw-battle-note { display: flex; flex: none; align-items: center; gap: 8px; padding: 6px 14px; font-size: 12.5px; color: #ffe2a8; background: linear-gradient(90deg, rgba(120, 40, 24, .55), rgba(60, 24, 16, .35)); border-bottom: 1px solid rgba(201, 164, 92, .35); }
.cw-battle-note.hidden { display: none; }
.cw-battle-note b { font-size: 14px; color: #ffb36b; }

/* แท็บสถานะ */
.tab-stat-wrap { display: grid; grid-template-columns: 220px 1fr 230px; gap: 16px; }
.st-profile { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.big-portrait { position: relative; width: 136px; height: 136px; margin-bottom: 6px; border: 2px solid var(--gold); border-radius: 8px; background: radial-gradient(circle at 50% 35%, #5a4430, #170f0a 75%); box-shadow: 0 0 0 3px #000, 0 0 0 4px var(--gold-lo), inset 0 0 22px rgba(0, 0, 0, .6); }
.big-portrait .portrait-img { display: block; width: 100%; height: 100%; border-radius: 6px; image-rendering: pixelated; object-fit: cover; }
.bp-lv { position: absolute; left: 50%; bottom: -11px; padding: 2px 12px; transform: translateX(-50%); font: 500 12px var(--font-h); color: #fff; background: linear-gradient(180deg, #b63c2f, #6a1c1c); border: 1px solid var(--gold); border-radius: 10px; white-space: nowrap; }
.bp-lv b { font-size: 15px; }
.st-name { margin-top: 6px; font: 600 21px/1.2 var(--font-h); text-shadow: 0 1px 3px #000; }
.st-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.st-meta { width: 100%; font-size: 12.5px; }
.st-meta div { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed rgba(201, 164, 92, .15); }
.st-meta span { color: var(--muted); white-space: nowrap; }
.st-meta b { font-weight: 600; text-align: right; }
.st-exp { width: 100%; margin-top: 4px; }
.st-exp-l { display: flex; justify-content: space-between; margin-bottom: 2px; font-size: 12px; color: var(--muted); }
.st-exp-l b { font: 500 12px var(--font-h); color: var(--cream); }
.st-logout { margin-top: 10px; }
.dv-bars { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.dv-bars .bar { height: 18px; } .dv-bars .bar-text { line-height: 16px; }
.dv-grid, .dv-special { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.dv-row { display: flex; justify-content: space-between; gap: 6px; padding: 4px 7px; font-size: 12.5px; background: rgba(255, 255, 255, .035); border-radius: 3px; }
.dv-row span { color: var(--muted); }
.dv-row b { font: 500 13px var(--font-h); color: var(--cream); }
.dv-special { margin-top: 6px; }
.dv-special .sec-sub { grid-column: 1 / -1; margin-bottom: 0; }
.dv-row.sp b { color: #9fdcff; }
.dv-special.empty { display: block; margin-top: 12px; font-size: 12px; font-style: italic; color: var(--dim); }
.pts-box { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding: 7px 12px; color: var(--muted); background: rgba(0, 0, 0, .3); border: 1px solid var(--gold-lo); border-radius: 6px; }
.pts-box b { font: 700 24px/1 var(--font-h); color: var(--dim); }
.pts-box.has { border-color: var(--gold); animation: glow 2s ease-in-out infinite; color: var(--cream); }
.pts-box.has b { color: var(--gold-hi); text-shadow: 0 0 10px rgba(240, 210, 138, .6); }
.al-row { display: grid; grid-template-columns: 1fr auto 34px 34px; align-items: center; gap: 8px; padding: 5px 4px 5px 6px; border-bottom: 1px dashed rgba(201, 164, 92, .15); cursor: help; }
.al-row:hover { background: rgba(201, 164, 92, .06); }
.al-name b { display: inline-block; min-width: 38px; font: 600 13px var(--font-h); color: var(--gold); }
.al-name span { font-size: 12.5px; color: var(--muted); }
.al-val { font: 600 17px var(--font-h); }
.btn-plus { display: grid; place-items: center; width: 32px; height: 32px; padding: 0 0 2px; font: 700 19px/1 var(--font-h); color: #fff; background: radial-gradient(circle at 40% 35%, #cc4e3c, #6a1c1c); border: 1px solid var(--gold); border-radius: 50%; cursor: pointer; pointer-events: auto; box-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.btn-plus:hover:not(:disabled) { filter: brightness(1.2); box-shadow: 0 0 10px rgba(255, 120, 80, .5); }
.btn-plus:disabled { color: #5a4d3c; background: #2a221a; border-color: #4a3d2c; cursor: default; box-shadow: none; }
.btn-plus10 { padding: 0; font-size: 12.5px; letter-spacing: -.3px; }
.al-hint { margin-top: 8px; font-size: 11.5px; text-align: center; color: var(--dim); }
.al-reset { display: flex; justify-content: center; margin-top: 10px; }
.btn-reset { display: inline-flex; align-items: center; gap: 5px; }
.btn-reset .ico { width: 14px; height: 14px; }
.btn-reset small { padding: 0 5px; font-size: 10.5px; color: #9fe39a; border: 1px solid rgba(143, 224, 143, .45); border-radius: 8px; }
.sk-bar .btn-reset { margin-left: auto; }
/* ล้างแต้ม/เปลี่ยนธาตุ (ui/reset.js): ค่าล้างแบบใช้ยันต์ · ปุ่มในสำนักยุทธ์ · ชวนไปร้านแคช · หน้าต่างเลือกธาตุ */
.btn-reset small.paid { color: #ffcf7a; border-color: rgba(255, 207, 122, .5); }
.rs-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.rs-shop { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0 2px; font: 600 15px var(--font-h); color: var(--gold-hi); }
.rs-shop-ico { width: 40px; height: 40px; }
.rs-els { display: flex; flex-direction: column; gap: 6px; max-height: min(56vh, 420px); overflow-y: auto; margin: 10px 0 6px; padding-right: 2px; }
.rs-el { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 9px; color: inherit; font: inherit; text-align: left; cursor: pointer;
  background: rgba(0, 0, 0, .28); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-radius: 8px; }
.rs-el:hover:not(:disabled) { border-color: var(--c); }
.rs-el.sel { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c), 0 0 12px color-mix(in srgb, var(--c) 35%, transparent); background: color-mix(in srgb, var(--c) 16%, rgba(0, 0, 0, .3)); }
.rs-el:disabled { opacity: .5; cursor: default; }
.rs-el-port { flex: none; width: 56px; height: 56px; overflow: hidden; border: 1px solid var(--c); border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c) 30%, #1a1410), #140f0b); }
.rs-el-port > * { width: 100%; height: 100%; }
.rs-el-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rs-el-main b { font: 600 14px var(--font-h); color: var(--c); }
.rs-el-main em { margin-left: 6px; font-style: normal; font-size: 11px; color: var(--muted); }
.rs-el-main small { font-size: 11.5px; color: var(--text2); }
.rs-trees { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.rs-tree { display: inline-flex; align-items: center; gap: 2px; padding: 0 5px; font-size: 11px; color: var(--text2); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); border-radius: 8px; }
.rs-tree.opp { opacity: .55; text-decoration: line-through; }

/* แท็บสกิล — แผนผังสายสกิลแบบต้นไม้ */
.win-body.tab-skill { overflow: hidden; display: flex; flex-direction: column; padding: 12px 14px; }
.skill-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; flex: 1; min-height: 0; }
.sk-left { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.sk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 6px 12px; background: rgba(0, 0, 0, .3); border: 1px solid var(--gold-lo); border-radius: 8px; }
.sk-bar.has { border-color: #6fa8ff; box-shadow: inset 0 0 18px rgba(80, 140, 255, .12); }
.sk-pts { display: flex; align-items: baseline; gap: 8px; }
.sk-pts span { font: 500 13px var(--font-h); color: var(--muted); }
.sk-pts b { font: 700 26px/1 var(--font-h); color: var(--dim); }
.sk-bar.has .sk-pts b { color: #9fd0ff; text-shadow: 0 0 10px rgba(110, 170, 255, .7); animation: pulse 1.6s infinite; }
.sk-bar-hint { flex: 1; min-width: 200px; font-size: 12px; color: var(--muted); }
.sk-legend { display: flex; gap: 10px; font-size: 11px; color: var(--muted); }
.sk-legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 4px; border-radius: 2px; vertical-align: 0; }
.lg-can::before { background: #ffd27a; box-shadow: 0 0 5px #ffd27a; }
.lg-learned::before { background: #6fe08a; }
.lg-locked::before { background: #4a4036; }
.sk-trees { flex: 1; min-height: 0; padding-right: 4px; }
.sk-sec { --c: var(--gold); margin-bottom: 12px; }
.sk-sec-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; padding: 4px 10px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 22%, transparent), transparent 80%); border-left: 3px solid var(--c); border-radius: 0 4px 4px 0; }
.sk-sec-title i { font-style: normal; font-size: 15px; }
.sk-sec-title b { font: 600 15px var(--font-h); color: var(--c); text-shadow: 0 1px 2px #000; }
.sk-sec-title small { font: 400 12px var(--font-h); color: var(--muted); }
.sk-tree { position: relative; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-auto-rows: 72px; }
.sk-lines { position: absolute; inset: 0; pointer-events: none; }
.sk-lines svg { width: 100%; height: 100%; display: block; overflow: visible; }
.sk-lines path { fill: none; stroke: #4a3e30; stroke-width: 2; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.sk-lines path.met { stroke: var(--c); stroke-dasharray: none; stroke-width: 2.5; }
.sk-node { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; margin: 5px 4%; padding: 4px 28px 4px 5px; min-width: 0; color: var(--cream); background: linear-gradient(180deg, #2a2119, #17110d); border: 1px solid #4a3c2c; border-radius: 8px; cursor: pointer; outline: none; transition: border-color .15s, box-shadow .15s; }
.sk-node:hover { border-color: var(--gold); }
.sk-node:focus-visible { box-shadow: 0 0 0 2px var(--gold-hi); }
.sk-node.learned { border-color: color-mix(in srgb, var(--c) 65%, #3a2e20); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 16%, #2a2119), #17110d); }
.sk-node.maxed { border-color: #ffd27a; background: linear-gradient(180deg, #4a3818, #1f170c); }
.sk-node.locked { opacity: .62; }
.sk-node.locked .skn-ico { filter: grayscale(1) brightness(.7); }
.sk-node.can { border-color: #ffd27a; animation: canGlow 1.8s ease-in-out infinite; }
.sk-node.sel { opacity: 1; animation: none; border-color: #fff3c4; outline: 2px solid var(--gold-hi); outline-offset: 2px; box-shadow: 0 0 16px rgba(240, 210, 138, .55); }
.sk-node.sel.locked .skn-ico { filter: grayscale(.6); }
.skn-ico { position: relative; flex: none; width: 34px; height: 34px; }
.skn-ico .sk-img { width: 34px; height: 34px; }
.skn-lock { position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 16px; height: 16px; color: #d8c8a8; background: #1a130e; border: 1px solid #5a4a38; border-radius: 50%; }
.skn-lock .ico { width: 10px; height: 10px; }
.sk-node.can .skn-lock { display: none; }
.skn-main { min-width: 0; flex: 1; }
.skn-name { display: -webkit-box; overflow: hidden; font: 600 12.5px/1.18 var(--font-h); -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.sk-node.learned .skn-name, .sk-node.maxed .skn-name { color: var(--gold-hi); }
.skn-meta { display: flex; flex-wrap: wrap; gap: 0 8px; font: 500 11px/1.35 var(--font-h); }
.skn-lv { color: #9be89b; }
.skn-lv.zero { color: var(--dim); }
.skn-sp { color: #8ec0ff; }
.skn-req { font-size: 10.5px; }
.skn-plus { position: absolute; right: 5px; top: 50%; display: grid; place-items: center; width: 22px; height: 22px; margin-top: -11px; padding: 0 0 1px; font: 700 15px/1 var(--font-h); color: #fff; background: radial-gradient(circle at 40% 35%, #cc4e3c, #6a1c1c); border: 1px solid var(--gold); border-radius: 50%; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.skn-plus:hover:not(:disabled) { filter: brightness(1.25); box-shadow: 0 0 10px rgba(255, 120, 80, .6); }
.skn-plus:disabled { color: #5a4d3c; background: #241c15; border-color: #3e3326; cursor: default; box-shadow: none; }
.sk-img { display: block; border-radius: 6px; image-rendering: pixelated; object-fit: contain; }
.sk-fb { display: grid; place-items: center; font: 20px/1 var(--font-cn); color: #fff; text-shadow: 0 1px 2px #000; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 85%, #fff 10%), color-mix(in srgb, var(--c) 35%, #0a0604) 80%); border: 1px solid color-mix(in srgb, var(--c) 60%, #000); box-shadow: inset 0 0 8px rgba(0, 0, 0, .5); }
.sk-detail { --c: var(--gold); display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; padding: 12px; background: linear-gradient(180deg, rgba(42, 32, 23, .9), rgba(18, 13, 10, .92)); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--gold-lo)); border-radius: 8px; }
.sk-detail.empty { display: grid; place-items: center; color: var(--dim); font-style: italic; }
.skd-head { display: flex; align-items: center; gap: 10px; }
.skd-ico, .skd-ico.sk-img { flex: none; width: 52px; height: 52px; border-radius: 8px; box-shadow: 0 0 0 2px #000, 0 0 12px color-mix(in srgb, var(--c) 50%, transparent); }
.skd-ico.sk-fb { font-size: 28px; }
.skd-name { font: 600 19px/1.2 var(--font-h); color: var(--gold-hi); text-shadow: 0 1px 2px #000; }
.skd-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.skd-lvrow { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--muted); }
.skd-lvrow > b { font: 600 16px var(--font-h); color: var(--cream); }
.skd-sp { margin-left: auto; }
.skd-sp b { font: 600 16px var(--font-h); color: #8ec0ff; }
.skd-pips { display: flex; gap: 3px; margin-top: -4px; }
.skd-pips i { flex: 1; height: 6px; background: rgba(0, 0, 0, .5); border: 1px solid #3a2e22; border-radius: 2px; }
.skd-pips i.on { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 80%, #fff 15%), var(--c)); border-color: color-mix(in srgb, var(--c) 60%, #000); box-shadow: 0 0 4px color-mix(in srgb, var(--c) 60%, transparent); }
.skd-block { padding: 7px 9px; background: rgba(0, 0, 0, .28); border: 1px solid rgba(201, 164, 92, .18); border-radius: 6px; }
.skd-block.next { border-style: dashed; }
.skd-label { margin-bottom: 2px; font: 500 11.5px var(--font-h); color: var(--gold); }
.skd-block p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--text2); }
.skd-block.next p { color: #bfe6c4; }
.skd-req { margin: 0; padding: 0; list-style: none; font: 500 12.5px/1.6 var(--font-h); }
.skd-req li::before { content: '✔ '; }
.skd-req li.bad::before { content: '✖ '; }
.skd-req small { font-weight: 400; color: var(--dim); }
.skd-learn { width: 100%; margin-top: 2px; }
.skd-learn .ico { width: 17px; height: 17px; }
.skd-why { font-size: 12px; text-align: center; color: var(--bad); }
.skd-max { padding: 8px; font: 600 14px var(--font-h); text-align: center; color: #ffd27a; background: rgba(255, 210, 122, .08); border: 1px solid rgba(255, 210, 122, .4); border-radius: 6px; }

/* แท็บกระเป๋า */
.inv-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 16px; height: 100%; min-height: 0; }
.win-body.tab-inv { overflow: hidden; display: flex; flex-direction: column; }
.win-body.tab-inv > .inv-wrap { flex: 1; }
.inv-equip { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
/* ตุ๊กตาอุปกรณ์ 7 ช่อง: ซ้าย หมวก/สร้อย/ชุดเกราะ/รองเท้า · กลาง ตัวละครเต็มตัว · ขวา ตุ้มหู/อาวุธ/แหวน */
.eq-doll { display: grid; grid-template-columns: minmax(0, 1fr) 100px minmax(0, 1fr); gap: 4px; padding: 8px 4px; background: radial-gradient(ellipse 46% 40% at 50% 52%, rgba(201, 164, 92, .16), transparent 70%), rgba(0, 0, 0, .26); border: 1px solid rgba(201, 164, 92, .22); border-radius: 8px; }
.eq-col { display: flex; flex-direction: column; justify-content: space-between; gap: 5px; min-width: 0; }
.eq-col.right { justify-content: space-around; }
.eq-figure { position: relative; display: grid; place-items: center; align-self: center; }
.eq-figure::before { content: ''; position: absolute; left: 50%; bottom: 0; width: 84px; height: 22px; margin-left: -42px; border: 1px solid rgba(201, 164, 92, .35); border-radius: 50%; background: radial-gradient(ellipse, rgba(201, 164, 92, .18), transparent 70%); }
.eq-figure-cv { position: relative; width: 100px; height: 160px; }
.eq-figure .portrait-img { width: 96px; height: 96px; overflow: hidden; border: 1px solid var(--gold-lo); border-radius: 50%; image-rendering: pixelated; object-fit: cover; }
.eq-who { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; }
.eq-who-btn { flex: none; min-width: 34px; }
.eq-who-name { display: flex; flex: 1; align-items: center; justify-content: center; gap: 6px; min-width: 0; font: 600 13px var(--font-h); color: var(--gold); }
.eq-who-name b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.eq-who-name small { flex: none; font-weight: 400; color: var(--muted); }
.eq-who-name img, .eq-who-name .portrait-img { width: 22px; height: 22px; border-radius: 50%; }
.eq-slot { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; text-align: center; }
.eq-slot > .slot { margin-bottom: 2px; }
.eq-slot > .slot-lg { width: 52px; height: 52px; }
.eq-label { font: 500 10.5px/1.25 var(--font-h); color: var(--muted); }
.eq-name { display: -webkit-box; overflow: hidden; width: 100%; min-height: 1.25em; font: 500 11.5px/1.25 var(--font-h); color: var(--dim); -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.eq-slot.empty .eq-name { font-weight: 400; opacity: .7; }
.slot .eq-ghost { opacity: .2; filter: grayscale(1) brightness(1.5); }
.inv-gold { margin-top: 10px; padding: 8px 12px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(201, 164, 92, .3); border-radius: 6px; font-size: 15px; }
.inv-bag { display: flex; flex-direction: column; min-height: 0; }
.inv-scroll { flex: 1; min-height: 0; padding: 2px; }
.inv-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.inv-count { margin-left: auto; }
.inv-hint { margin-top: 8px; font-size: 11.5px; text-align: center; color: var(--dim); }
.slot { position: relative; display: grid; place-items: center; aspect-ratio: 1; min-width: 0; pointer-events: auto; background: linear-gradient(180deg, #110d09, #1d1611); border: 1px solid #3a2e20; border-radius: 5px; box-shadow: inset 0 0 7px rgba(0, 0, 0, .85); }
.slot.filled { border-color: color-mix(in srgb, var(--tc) 50%, #3a2e20); cursor: pointer; }
.slot.filled:hover { border-color: var(--gold-hi); box-shadow: inset 0 0 7px rgba(0, 0, 0, .85), 0 0 8px rgba(240, 210, 138, .5); }
.slot.rare { box-shadow: inset 0 0 12px color-mix(in srgb, var(--tc) 40%, transparent), inset 0 0 4px rgba(0, 0, 0, .8); }
.slot .item-img { width: 84%; height: 84%; object-fit: contain; image-rendering: pixelated; pointer-events: none; }
.slot.unusable::after { content: ''; position: absolute; inset: 0; border-radius: 5px; background: rgba(170, 30, 30, .28); pointer-events: none; }
.item-fb { display: grid; place-items: center; font-size: 20px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c) 45%, transparent), transparent 70%); }
.badge-qty { position: absolute; right: 2px; bottom: 0; font: 600 11px/1.2 var(--font-h); color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000, 0 0 3px #000; pointer-events: none; }
.badge-plus { position: absolute; left: 2px; top: 1px; font: 700 10.5px/1.1 var(--font-h); color: #ffd84a; text-shadow: 0 0 2px #000, 0 0 3px #000; pointer-events: none; }
.slot-lg { flex: none; width: 56px; height: 56px; }
.slot-md { flex: none; width: 46px; height: 46px; }
.slot-sm { flex: none; width: 38px; height: 38px; }
.item-pop { max-width: 280px; }

/* แท็บเควส */
.quest-wrap { max-height: 100%; }
.quest-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.quest-card { padding: 10px 12px; background: linear-gradient(135deg, rgba(201, 164, 92, .08), rgba(0, 0, 0, .25)); border: 1px solid rgba(201, 164, 92, .3); border-radius: 8px; }
.quest-card.ready { border-color: #4a8a5a; box-shadow: inset 0 0 22px rgba(111, 224, 138, .08); }
.qc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qc-head b { font: 600 16px var(--font-h); color: var(--gold-hi); }
.qc-desc { margin: 4px 0; font-size: 13px; color: var(--text2); }
.qc-goals { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.qc-goal { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.qc-goal b { font-family: var(--font-h); font-weight: 600; }
.qc-goal.ok b { color: var(--good); }
.qc-gmain { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.qc-mon { flex: none; width: 34px; height: 34px; image-rendering: pixelated; background: rgba(0, 0, 0, .35); border: 1px solid rgba(201, 164, 92, .3); border-radius: 50%; object-fit: contain; }
.mon-fb { display: grid; place-items: center; font-size: 18px; }
.qc-foot { margin-top: 6px; font-size: 12px; color: var(--muted); }
.next-quest { margin-bottom: 14px; padding: 2px 12px 12px; background: rgba(0, 0, 0, .2); border: 1px dashed var(--gold-lo); border-radius: 8px; }
.next-quest.all-done { padding: 12px; font: 500 15px var(--font-h); text-align: center; color: var(--gold-hi); }
.nq-body b { font: 600 15px var(--font-h); }
.nq-lv { font: 500 12px var(--font-h); }
.nq-desc { margin: 2px 0 6px; font-size: 13px; color: var(--text2); }
.nq-where { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 12.5px; color: var(--muted); }
.done-list { display: flex; flex-wrap: wrap; gap: 6px; }
.done-q { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; font-size: 12.5px; color: var(--muted); border: 1px solid rgba(201, 164, 92, .2); border-radius: 12px; }
.done-q .ico { width: 14px; height: 14px; color: var(--good); }
.rewards { display: flex; flex-wrap: wrap; gap: 6px; }
.rw { display: flex; align-items: center; gap: 5px; padding: 3px 10px 3px 6px; font-size: 13px; background: rgba(0, 0, 0, .32); border: 1px solid rgba(201, 164, 92, .25); border-radius: 16px; }
.rw b { font: 600 13px var(--font-h); color: var(--gold-hi); }
.rw small { color: var(--muted); }
.rw-ico.exp { padding: 1px 5px; font: 700 9.5px/1.5 var(--font-h); color: #e6d8ff; background: #5a3a8a; border-radius: 8px; }
.rw-img { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; }
.rw .item-fb { width: 24px; height: 24px; font-size: 14px; }
.rw-special { color: var(--gold-hi); background: rgba(201, 164, 92, .14); border-color: var(--gold); }

/* แท็บปาร์ตี้ */
.party-list { display: flex; flex-direction: column; gap: 8px; }
.pm-card { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; padding: 10px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(201, 164, 92, .3); border-radius: 8px; }
.pm-card.me { border-color: var(--gold); background: rgba(201, 164, 92, .06); }
.pm-port { position: relative; width: 64px; height: 64px; }
.pm-port .portrait-img { width: 64px; height: 64px; border: 2px solid var(--gold-lo); border-radius: 50%; background: #1a120c; image-rendering: pixelated; object-fit: cover; }
.pm-port .crown { top: -9px; left: -5px; width: 24px; height: 24px; }
.pm-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pm-name { display: flex; align-items: center; gap: 6px; }
.pm-name b { font: 600 16px var(--font-h); }
.pm-name small { color: var(--muted); }
.pm-sub { font-size: 12.5px; color: var(--muted); }
.pm-acts { display: flex; flex-direction: column; gap: 6px; }
.party-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.party-foot p { margin: 0; }
.party-empty { padding: 30px 20px; text-align: center; color: var(--muted); }
/* สมุดการ์ด */
.card-wrap { display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.card-count b { font: 700 20px var(--font-h); color: var(--gold-hi); margin-right: 5px; }
.card-count span { color: var(--muted); font-size: 12.5px; }
.card-total { display: flex; flex: 1; flex-wrap: wrap; gap: 4px; min-width: 0; }
.card-chip { white-space: nowrap; padding: 1px 8px; font: 500 12.5px var(--font-h); color: #9fe07a; background: rgba(159, 224, 122, .1); border: 1px solid rgba(159, 224, 122, .35); border-radius: 10px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; flex: 1; min-height: 0; padding-right: 3px; }
.card-tile { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px 7px; text-align: center; background: rgba(0, 0, 0, .3); border: 1px solid rgba(207, 216, 232, .25); border-radius: 6px; }
.card-tile.boss { border-color: rgba(255, 207, 74, .6); }
.card-tile.own { background: rgba(159, 224, 122, .07); }
.card-tile.miss .card-mon { opacity: .28; filter: grayscale(1); }
.card-mon { width: 56px; height: 56px; object-fit: contain; }
.card-name { font: 600 12.5px var(--font-h); line-height: 1.25; color: var(--cream); }
.card-tile small { font-size: 11px; color: var(--muted); }
.card-stat { margin-top: 2px; font: 600 12.5px var(--font-h); color: #9fe07a; }
.card-miss { margin-top: 2px; font: 700 13px var(--font-h); color: var(--dim); }
.card-tile .btn { margin-top: 3px; }
.card-note { margin: 0; font-size: 12px; }
@media (max-width: 700px) { .card-total { order: 3; flex-basis: 100%; } }
.party-empty p { max-width: 460px; margin: 8px auto 0; line-height: 1.6; }
.pe-icon { width: 64px; height: 64px; margin: 0 auto 10px; color: var(--gold-lo); }
.pe-icon .ico { width: 100%; height: 100%; }
.party-empty b { font: 600 18px var(--font-h); color: var(--cream); }

/* ---------------------------------------------------------------- NPC */
.npc-win { width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 70px); }
.npc-win.expanded { height: min(660px, calc(100vh - 70px)); }
.npc-top { display: flex; flex: none; align-items: flex-start; gap: 16px; padding: 14px 16px 10px; }
.npc-port { flex: none; width: 104px; height: 104px; overflow: hidden; border: 2px solid var(--gold); border-radius: 8px; background: radial-gradient(circle at 50% 35%, #5a4430, #170f0a 75%); box-shadow: 0 0 0 3px #000, 0 0 0 4px var(--gold-lo); }
.npc-port .portrait-img { display: block; width: 100%; height: 100%; image-rendering: pixelated; object-fit: cover; }
.npc-talk { flex: 1; min-width: 0; }
.npc-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 6px; }
.npc-name { font: 600 20px/1.2 var(--font-h); color: var(--gold-hi); text-shadow: 0 1px 2px #000; }
.npc-title { font: 400 13px var(--font-h); color: var(--muted); }
.npc-title:not(:empty)::before { content: '·'; margin-right: 8px; }
.npc-speech { position: relative; min-height: 66px; padding: 10px 26px 10px 14px; font-size: 14.5px; line-height: 1.65; color: var(--cream); background: linear-gradient(180deg, rgba(243, 230, 200, .09), rgba(243, 230, 200, .04)); border: 1px solid rgba(201, 164, 92, .32); border-radius: 6px; cursor: pointer; }
.npc-speech::before { content: ''; position: absolute; left: -7px; top: 18px; width: 12px; height: 12px; transform: rotate(45deg); background: #2a2017; border-left: 1px solid rgba(201, 164, 92, .32); border-bottom: 1px solid rgba(201, 164, 92, .32); }
.npc-speech.more::after { content: '▼'; position: absolute; right: 9px; bottom: 5px; font-size: 10px; color: var(--gold); animation: bob 1s ease-in-out infinite; }
.npc-opts { display: flex; flex: none; flex-wrap: wrap; gap: 6px; padding: 2px 16px 12px; }
.npc-opt { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 15px; font: 500 14px var(--font-h); color: var(--cream); background: linear-gradient(180deg, #3b2e22, #231a13); border: 1px solid var(--gold-lo); border-radius: 20px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.npc-opt .ico { width: 17px; height: 17px; color: var(--gold); }
.npc-opt:hover { border-color: var(--gold); box-shadow: 0 0 10px rgba(201, 164, 92, .3); }
.npc-opt.active { color: #fff; background: linear-gradient(180deg, #ac3c2f, #6e1e1e); border-color: var(--gold); }
.npc-opt.active .ico { color: var(--gold-hi); }
.npc-opt.bye { margin-left: auto; background: transparent; color: var(--muted); }
.npc-opt em { position: absolute; top: -6px; right: -4px; width: 19px; height: 19px; font: 700 12px/19px var(--font-h); font-style: normal; text-align: center; color: #2a1a0a; background: var(--gold-hi); border-radius: 50%; box-shadow: 0 0 0 2px #000; }
.npc-opt em.ready { background: #6fe08a; animation: pulse 1s infinite; }
.npc-panel { display: none; flex: 1; flex-direction: column; min-height: 0; padding: 10px 14px 12px; background: rgba(0, 0, 0, .22); border-top: 1px solid var(--gold-lo); border-radius: 0 0 var(--r) var(--r); }
.npc-win.has-panel .npc-panel { display: flex; }
.npc-win.has-panel:not(.expanded) .npc-panel > * { flex: none; }
.npc-panel > * { flex: 1; min-height: 0; }
.panel-bar { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.panel-bar > b { font: 600 15px var(--font-h); color: var(--gold); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; pointer-events: auto; }
.check input { width: 16px; height: 16px; accent-color: var(--verm-hi); }
.shop { display: flex; flex-direction: column; min-height: 0; }
.shop-list { display: flex; flex: 1; flex-direction: column; gap: 5px; min-height: 0; padding-right: 4px; }
.shop-row { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 10px; padding: 6px 8px; background: rgba(255, 255, 255, .03); border: 1px solid rgba(201, 164, 92, .18); border-radius: 6px; }
.shop-row:hover { border-color: rgba(201, 164, 92, .45); background: rgba(201, 164, 92, .05); }
.shop-row.req-bad .sr-name { opacity: .75; }
.sr-main { min-width: 0; }
.sr-name { font: 600 14px var(--font-h); }
.sr-name small { font-weight: 400; color: var(--muted); }
.sr-info { overflow: hidden; font-size: 12px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.sr-buy { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.sr-price { display: flex; align-items: center; font: 600 14px var(--font-h); color: var(--gold-hi); }
.sr-price.sell { color: #9be89b; }
.sr-ctrl { display: flex; align-items: center; gap: 6px; }
.stepper { display: flex; align-items: center; overflow: hidden; border: 1px solid var(--gold-lo); border-radius: 4px; }
.step-b { width: 30px; height: 32px; padding: 0; font: 600 16px var(--font-h); color: var(--gold); background: #2a2119; border: 0; cursor: pointer; }
.step-b:hover { background: #3a2d21; }
.step-in { width: 44px; min-height: 32px; height: 32px; padding: 0 2px; text-align: center; border: 0; border-radius: 0; font-family: var(--font-h); }

.refine { display: grid; grid-template-columns: 240px 1fr; gap: 12px; min-height: 0; }
.rf-list { display: flex; flex-direction: column; gap: 4px; min-height: 0; padding-right: 3px; }
.rf-item { display: flex; align-items: center; gap: 8px; padding: 5px 6px; text-align: left; color: var(--cream); background: rgba(255, 255, 255, .03); border: 1px solid rgba(201, 164, 92, .18); border-radius: 6px; cursor: pointer; }
.rf-item:hover { border-color: rgba(201, 164, 92, .5); }
.rf-item.sel { border-color: var(--gold); background: rgba(201, 164, 92, .14); }
.rf-item > div { min-width: 0; }
.rf-name { overflow: hidden; font: 500 13px/1.3 var(--font-h); white-space: nowrap; text-overflow: ellipsis; }
.rf-item small { font-family: var(--font-b); font-size: 11px; color: var(--muted); }
.rf-detail { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0; overflow-y: auto; padding: 2px 4px; }
.rf-detail.empty { justify-content: center; color: var(--dim); font-style: italic; }
.rf-anvil { position: relative; display: grid; place-items: center; flex: none; width: 100%; height: 124px; overflow: hidden; border-radius: 8px; background: radial-gradient(ellipse at 50% 75%, rgba(255, 130, 50, .25), transparent 60%), rgba(0, 0, 0, .2); }
.rf-big { position: relative; display: grid; place-items: center; width: 86px; height: 86px; background: radial-gradient(circle, #2c2119, #0e0a07); border: 2px solid var(--gold); border-radius: 10px; box-shadow: 0 0 22px rgba(255, 150, 60, .3); }
.rf-big .item-img { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; }
.rf-plus { position: absolute; top: -10px; right: -12px; padding: 1px 8px; font: 700 14px var(--font-h); color: #ffd84a; background: #8e2b2b; border: 1px solid var(--gold); border-radius: 10px; }
.rf-anvil.fx-work .rf-big { animation: shakeS .18s infinite; }
.rf-title { font: 600 17px var(--font-h); text-align: center; }
.rf-arrow { color: var(--good); }
.rf-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }
.rf-stat { font-size: 13px; }
.rf-stat span { margin-right: 4px; color: var(--muted); }
.rf-stat b { font-family: var(--font-h); font-weight: 500; }
.rf-stat em { margin-left: 4px; font-family: var(--font-h); font-style: normal; color: var(--good); }
.rf-costs { display: flex; flex-direction: column; gap: 5px; width: min(380px, 100%); padding: 8px 12px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(201, 164, 92, .25); border-radius: 6px; }
.rf-rate, .rf-cost { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; font-size: 13px; }
.rf-rate span, .rf-cost span { color: var(--muted); }
.rf-rate b { font: 700 19px var(--font-h); }
.rf-cost b { display: flex; align-items: center; gap: 4px; font: 500 14px var(--font-h); }
.rf-stone { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; }
.rate-bar { width: 100%; height: 5px; margin-top: 2px; overflow: hidden; background: rgba(0, 0, 0, .5); border-radius: 3px; }
.rate-bar i { display: block; height: 100%; background: linear-gradient(90deg, #c0392b, #ffc857 50%, #6fe08a); background-size: 380px 100%; }
.rf-warn { padding: 4px 10px; font-size: 12.5px; color: var(--bad); background: rgba(255, 123, 107, .1); border: 1px solid rgba(255, 123, 107, .45); border-radius: 4px; }
.rf-note { font-size: 12px; color: var(--dim); }
.rf-safe { padding: 4px 10px; font-size: 12.5px; color: #9fe07a; background: rgba(159, 224, 122, .1); border: 1px solid rgba(159, 224, 122, .45); border-radius: 4px; }
.rf-luck { margin-left: 6px; font: 500 12.5px var(--font-h); font-style: normal; color: #9fe07a; }
.rf-charms { display: flex; flex-wrap: wrap; gap: 6px; }
.charm-tg { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 4px; font: 500 12.5px var(--font-h); color: var(--cream); background: rgba(0, 0, 0, .3); border: 1px solid rgba(255, 255, 255, .16); border-radius: 4px; cursor: pointer; }
.charm-tg b { font-weight: 500; color: var(--muted); }
.charm-tg.on { background: rgba(159, 224, 122, .14); border-color: rgba(159, 224, 122, .7); }
.charm-tg.on b { color: #9fe07a; }
.rf-max { font: 500 14px var(--font-h); color: var(--gold-hi); }
.rf-go { position: sticky; bottom: 0; z-index: 1; flex: none; min-width: 180px; }   /* ปุ่มหลักเห็นเสมอแม้รายละเอียดยาวจนต้องเลื่อน */
.rf-fx { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(10, 7, 5, .78); cursor: pointer; }
.rf-hammer { width: 54px; height: 54px; color: var(--gold-hi); transform-origin: 75% 75%; animation: hammer .3s ease-in-out infinite alternate; }
.rf-hammer .ico { width: 100%; height: 100%; }
.rf-fx-t { position: relative; font: 700 26px var(--font-h); color: var(--gold-hi); text-shadow: 0 0 14px rgba(255, 200, 90, .6), 0 2px 2px #000; }
.rf-fx.ok .rf-fx-t { color: #ffe27a; animation: zoomin .45s cubic-bezier(.2, 1.6, .4, 1); }
.rf-fx.fail .rf-fx-t { color: #ff7b6b; text-shadow: 0 0 12px rgba(255, 80, 60, .5), 0 2px 2px #000; animation: shake .4s; }
.rf-fx-s { position: relative; font: 500 15px var(--font-h); color: var(--cream); }
.rf-sparks { position: absolute; left: 50%; top: 50%; }
.rf-sparks i { position: absolute; left: -2px; top: -7px; width: 4px; height: 14px; border-radius: 2px; background: linear-gradient(#fff, #ffb03a); animation: spark .75s ease-out forwards; }
.rf-fx.fail .rf-sparks i { background: linear-gradient(#bbb, #555); }

.simple-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 10px 6px; }
.npc-panel > .simple-panel { flex: none; }
.sp-ico { display: grid; place-items: center; flex: none; width: 66px; height: 66px; color: var(--gold-hi); background: radial-gradient(circle, #3a2a1e, #140f0b); border: 1px solid var(--gold); border-radius: 50%; }
.sp-ico .ico { width: 34px; height: 34px; }
.simple-panel.danger .sp-ico { color: #ff9a7a; border-color: #c0503a; }
.sp-main { flex: 1; min-width: 220px; }
.sp-main > b { font: 600 17px var(--font-h); color: var(--gold-hi); }
.sp-main p { margin: 4px 0 8px; font-size: 13.5px; line-height: 1.55; color: var(--text2); }
.sp-bars { display: flex; flex-direction: column; gap: 4px; max-width: 340px; margin-bottom: 6px; }
.sp-bars > div { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 6px; }
.sp-bars small { font: 500 11px var(--font-h); color: var(--muted); }
.sp-cost { display: flex; align-items: center; gap: 2px; color: var(--muted); }
.sp-cost b { margin: 0 3px 0 0; font: 600 16px var(--font-h); color: var(--gold-hi); }
.sp-cur { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 6px; font: 500 12px var(--font-h); color: var(--muted); }
/* ด่านสะพาน (ui/npc.js bridgePanel): รายชื่อขุนพล/ทหารที่ขวางสะพาน */
.br-squad { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.br-foe { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; background: linear-gradient(135deg, rgba(192, 80, 58, .16), rgba(0, 0, 0, .3)); border: 1px solid rgba(192, 80, 58, .4); border-radius: 8px; }
.br-foe.lead { border-color: #e0805a; box-shadow: 0 0 0 1px rgba(255, 140, 90, .25) inset; }
.br-foe.vice { border-color: #c9a45c; }
.br-face { width: 44px; height: 44px; flex: none; }
.br-who { display: flex; flex-direction: column; line-height: 1.25; }
.br-who b { font: 600 14px var(--font-h); color: var(--cream); }
.br-who b small { color: var(--muted); font-weight: 500; }
.br-who > small { font: 500 11.5px var(--font-h); color: var(--muted); }
.br-who em { margin-left: 6px; font-style: normal; color: #ffb090; }
.sp-cost.bad { color: #ff9a7a; }
/* หอทดสอบ (ui/npc.js towerPanel): รายการชั้น + ศัตรู/รางวัลของชั้นที่เลือก + อันดับ */
.tower { display: grid; grid-template-columns: 150px 1fr; gap: 12px; min-height: 0; }
.tw-list { display: flex; flex-direction: column; gap: 3px; min-height: 0; padding-right: 3px; }
.tw-floor { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 8px; color: var(--cream); background: rgba(255, 255, 255, .03); border: 1px solid rgba(201, 164, 92, .18); border-radius: 6px; cursor: pointer; }
.tw-floor b { font: 600 13px var(--font-h); }
.tw-floor small { font: 500 11.5px var(--font-h); color: var(--muted); }
.tw-floor.done small { color: #9fe07a; }
.tw-floor.next { border-color: #e0805a; }
.tw-floor.next small { color: #ffb090; }
.tw-floor.lock { opacity: .55; }
.tw-floor.boss b { color: var(--gold-hi); }
.tw-floor.sel { border-color: var(--gold); background: rgba(201, 164, 92, .16); opacity: 1; }
.tw-detail { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding-right: 3px; }
.tw-head { display: flex; align-items: center; gap: 8px; }
.tw-head > b { font: 700 18px var(--font-h); color: var(--gold-hi); }
.tw-head small { color: var(--muted); font-size: 12px; }
.tw-boss { padding: 1px 8px; font: 600 11.5px var(--font-h); color: #ffb090; border: 1px solid rgba(224, 128, 90, .6); border-radius: 10px; }
.tw-reward { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 10px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(201, 164, 92, .25); border-radius: 6px; }
.tw-reward > span:first-child { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.tw-reward b { font: 600 13.5px var(--font-h); color: #9fe07a; }
.tw-item { display: inline-flex; align-items: center; gap: 2px; font: 500 12.5px var(--font-h); color: var(--cream); }
.tw-ico { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; }
.tw-note { margin: 0; font-size: 12px; }
.tw-go { align-self: flex-start; min-width: 200px; }
.tw-top { padding-top: 6px; border-top: 1px solid rgba(201, 164, 92, .2); }
.tw-top > b { font: 600 13px var(--font-h); color: var(--gold); }
.tw-top ol { margin: 4px 0 0; padding-left: 22px; font-size: 13px; }
.tw-top li b { float: right; color: var(--gold-hi); font-weight: 600; }
@media (max-width: 700px) { .tower { grid-template-columns: 1fr; grid-template-rows: 132px minmax(0, 1fr); } .tw-go { align-self: stretch; } }
/* ขุนพลพเนจร (ui/npc.js wildPanel): ข้อมูลขุนพล + องครักษ์ + จับได้ไหม + ปุ่มท้าประลอง · --c = สีธาตุของขุนพล */
.wild-panel { align-items: flex-end; gap: 12px; }
.wild-panel .sp-main { min-width: 260px; display: flex; flex-direction: column; gap: 6px; }
.wild-panel .sec-sub { margin: 2px 0 0; }
.wg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wg-head > b { margin-right: 4px; font: 600 18px var(--font-h); color: var(--gold-hi); }
.wg-head > b small { font-weight: 500; color: var(--muted); }
.wg-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 5px 10px; background: rgba(0, 0, 0, .28); border: 1px solid color-mix(in srgb, var(--c, #c9a45c) 45%, transparent); border-radius: 6px; }
.wg-stats span { display: inline-flex; align-items: baseline; gap: 4px; }
.wg-stats small { font: 500 11px var(--font-h); color: var(--muted); }
.wg-stats b { font: 500 13.5px var(--font-h); color: var(--cream); }
.wg-guards { margin-bottom: 0; }
.wg-guards .br-face { width: 36px; height: 36px; }
.wg-cap { display: flex; align-items: flex-start; gap: 6px; padding: 6px 10px; font-size: 13px; line-height: 1.45; border-radius: 6px; }
.wg-cap .ico { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.wg-cap span { display: flex; flex-direction: column; }
.wg-cap small { font-size: 11.5px; color: var(--muted); }
.wg-cap.ok { color: #9ff0b0; background: rgba(80, 200, 120, .1); border: 1px solid rgba(80, 200, 120, .35); }
.wg-cap.bad { color: #ffb09a; background: rgba(192, 80, 58, .12); border: 1px solid rgba(192, 80, 58, .4); }
.wg-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; font-size: 12.5px; }
.wg-left { font: 500 12px var(--font-h); color: var(--dim); }
.tp-panel { display: flex; flex-direction: column; min-height: 0; }
.tp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; overflow-y: auto; }
.tp-card { display: flex; align-items: center; gap: 10px; padding: 10px; background: linear-gradient(135deg, rgba(201, 164, 92, .1), rgba(0, 0, 0, .3)); border: 1px solid rgba(201, 164, 92, .3); border-radius: 8px; }
.tp-ico { display: grid; place-items: center; flex: none; width: 38px; height: 38px; color: var(--gold); border: 1px solid var(--gold-lo); border-radius: 50%; }
.tp-ico .ico { width: 20px; height: 20px; }
.tp-main { flex: 1; min-width: 0; }
.tp-main b { display: block; font: 600 15px var(--font-h); }
.tp-main small { display: flex; align-items: center; gap: 2px; color: var(--muted); }
/* คอกม้า (ui/npc.js horsePanel): ภาพม้าของเรา + ความเร็ว + ค่าอัพระดับ (เครื่องรางม้าศึก) */
.horse-panel { display: flex; flex-direction: column; min-height: 0; }
.horse-panel .simple-panel { align-items: center; padding-top: 4px; }
.hs-stage { flex: none; width: 132px; height: 120px; background: radial-gradient(ellipse at 50% 82%, rgba(201, 164, 92, .24), rgba(0, 0, 0, .22) 72%); border: 1px solid rgba(201, 164, 92, .35); border-radius: 10px; }
.hs-charms { display: inline-flex; align-items: center; gap: 4px; font: 600 14px var(--font-h); color: var(--gold-hi); }
.hs-ci { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; vertical-align: middle; }
.hs-rows { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 4px; }
.hs-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13.5px; }
.hs-row > span { min-width: 84px; color: var(--muted); font: 500 12.5px var(--font-h); }
.hs-row > b { display: inline-flex; align-items: center; gap: 2px; font: 600 14.5px var(--font-h); color: var(--cream); }
.hs-row > b.bad { color: #ff9a7a; }
.hs-row > b.ok { color: #9fe07a; }
.hs-row > em { font-style: normal; color: #9fe07a; font: 500 13px var(--font-h); }
.hs-note { margin: 4px 0 0; font-size: 12px !important; color: var(--muted) !important; }
.hs-acts { display: flex; flex-direction: column; gap: 8px; }
.hs-acts .btn { justify-content: center; }
/* ตู้เสื้อผ้า (ui/wardrobe.js): ตัวอย่างยืน + ขี่ม้า · การ์ดสกินชุด/สกินม้า */
.st-wardrobe { margin-top: 8px; }
.wd-modal { width: min(560px, 100%); }
.wd-wrap { display: flex; flex-direction: column; gap: 8px; }
.wd-stage { display: flex; justify-content: center; align-items: flex-end; gap: 10px; padding: 6px; background: radial-gradient(ellipse at 50% 85%, rgba(201, 164, 92, .24), rgba(0, 0, 0, .22) 72%); border: 1px solid rgba(201, 164, 92, .35); border-radius: 10px; }
.wd-fig { width: 100px; height: 160px; }
.wd-mount { width: 132px; height: 120px; }
.wd-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; min-height: 1.6em; font-size: 12.5px; color: var(--muted); text-align: center; }
.wd-sec { margin-top: 2px; font: 600 13px var(--font-h); color: var(--gold-hi); }
.wd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.wd-card { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; text-align: left; color: var(--cream); background: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 255, 255, .14); border-radius: 6px; cursor: pointer; font: 500 12.5px/1.25 var(--font-h); }
.wd-card:hover { border-color: rgba(201, 164, 92, .6); }
.wd-card.sel { background: rgba(201, 164, 92, .16); border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.wd-card.locked .wd-name small { color: #ffcf7a; }
.wd-name small { display: block; font-size: 11px; color: var(--muted); }
.wd-ico { flex: none; width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.wd-none { display: grid; place-items: center; font-size: 18px; }
@media (max-width: 720px) { .st-wardrobe { grid-column: 1 / -1; justify-self: start; margin-top: 0; } .wd-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .hs-stage { width: 110px; height: 100px; } .hs-acts { flex-direction: row; flex-wrap: wrap; width: 100%; } .hs-acts .btn { flex: 1; } }
/* ใบวาป: รายการปลายทางในกล่องยืนยัน (ui/warp.js) */
.warp-list { display: flex; flex-direction: column; gap: 10px; max-height: min(52vh, 420px); overflow-y: auto; margin: 10px 0 6px; padding-right: 2px; }
.warp-prov { margin: 0 0 4px; color: var(--gold); font: 600 13px var(--font-h); }
.warp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.warp-card { width: 100%; padding: 8px; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.warp-card .tp-ico { width: 32px; height: 32px; }
.warp-card .tp-main b { font-size: 14px; }
.warp-card.sel { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: linear-gradient(135deg, rgba(201, 164, 92, .28), rgba(0, 0, 0, .3)); }
.warp-card:disabled { opacity: .45; cursor: default; }
.npc-quests { display: grid; grid-template-columns: 240px 1fr; gap: 12px; min-height: 0; }
.nq-list { display: flex; flex-direction: column; gap: 4px; min-height: 0; padding-right: 3px; }
.nq-item { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 5px 8px; text-align: left; color: var(--cream); background: rgba(255, 255, 255, .03); border: 1px solid rgba(201, 164, 92, .18); border-radius: 6px; cursor: pointer; }
.nq-item:hover { border-color: rgba(201, 164, 92, .5); }
.nq-item.sel { border-color: var(--gold); background: rgba(201, 164, 92, .14); }
.nq-item > div { flex: 1; min-width: 0; }
.nq-item b { display: block; overflow: hidden; font: 500 13.5px/1.3 var(--font-h); white-space: nowrap; text-overflow: ellipsis; }
/* ภาษาอังกฤษ: ชื่อเควสยาวกว่าไทยมาก — ให้ขึ้นบรรทัดใหม่แทนการตัด … (ไม่กระทบภาษาไทย) */
:lang(en) .nq-item:not(.gen-item) b { white-space: normal; }
.nq-item small { font: 11px var(--font-b); color: var(--muted); }
.nq-item.st-locked, .nq-item.st-done { opacity: .6; }
.nq-mark { display: grid; place-items: center; flex: none; width: 22px; height: 22px; font: 700 14px var(--font-h); color: var(--muted); background: #3a2d21; border-radius: 50%; }
.st-available .nq-mark { color: #2a1a0a; background: var(--gold-hi); }
.st-ready .nq-mark { color: #0a2a10; background: #6fe08a; }
.st-active .nq-mark { color: #fff; background: #4a6a9a; }
.st-done .nq-mark { color: var(--good); }
.nq-detail { min-height: 0; overflow-y: auto; padding-right: 4px; }
.nq-detail.empty { display: grid; place-items: center; color: var(--dim); font-style: italic; }
.nqd-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.nqd-head b { font: 600 18px var(--font-h); color: var(--gold-hi); }
.nqd-head span { font: 500 12px var(--font-h); white-space: nowrap; }
.nqd-desc { margin: 4px 0 8px; font-size: 13.5px; line-height: 1.6; color: var(--text2); }
.nqd-lock { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 6px 10px; font-size: 13px; color: var(--bad); background: rgba(255, 107, 90, .08); border: 1px solid rgba(255, 107, 90, .3); border-radius: 4px; }
.nqd-goals { display: flex; flex-direction: column; gap: 6px; }
.nqd-goals .sec-sub { margin-top: 0; }
.nq-detail .quest-card { margin-bottom: 4px; }
.nqd-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }

/* ---------------------------------------------------------------- Toast / ป้ายเลเวลอัพ / คำชวน / หลุดการเชื่อมต่อ */
.toasts { position: fixed; left: 50%; top: 66px; display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(540px, calc(100vw - 24px)); transform: translateX(-50%); pointer-events: none; }
.toast { --tc: var(--gold); display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 28px; font: 500 14.5px var(--font-h); color: var(--cream); text-shadow: 0 1px 2px #000; background: linear-gradient(90deg, rgba(18, 14, 10, 0), rgba(18, 14, 10, .92) 14%, rgba(18, 14, 10, .92) 86%, rgba(18, 14, 10, 0)); animation: toastin .25s ease-out; transition: opacity .4s, transform .4s; position: relative; }
.toast::before, .toast::after { content: ''; position: absolute; left: 8%; right: 8%; height: 1px; background: linear-gradient(90deg, transparent, var(--tc), transparent); }
.toast::before { top: 0; } .toast::after { bottom: 0; }
.toast.out { opacity: 0; transform: translateY(-8px); }
.t-ico { font-style: normal; color: var(--tc); }
.t-good { --tc: #6fe08a; color: #c4f7cd; }
.t-bad { --tc: #ff6b5a; color: #ffc6bc; }
.t-loot { --tc: #f0d28a; color: #ffe9b0; }
.t-quest { --tc: #b48cff; color: #e4d6ff; }
.level-banner { position: fixed; left: 50%; top: 34%; transform: translate(-50%, -50%); pointer-events: none; text-align: center; animation: lbin .7s cubic-bezier(.2, 1.6, .4, 1) both; }
.level-banner.out { animation: lbout .6s ease-in both; }
.lb-rays { position: absolute; left: 50%; top: 50%; width: 540px; height: 540px; margin: -270px 0 0 -270px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(255, 215, 120, .3) 0deg 7deg, transparent 7deg 18deg); -webkit-mask: radial-gradient(circle, #000 18%, transparent 66%); mask: radial-gradient(circle, #000 18%, transparent 66%); animation: spinr 9s linear infinite; }
.lb-main { position: relative; }
.lb-title { font: 700 clamp(52px, 11vw, 84px)/1.15 var(--font-h); letter-spacing: 2px; color: transparent; background: linear-gradient(180deg, #fffbe6, #ffd86a 45%, #c98a1e); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 4px 0 #5a2a0a) drop-shadow(0 0 22px rgba(255, 200, 90, .85)); white-space: nowrap; }
.lb-msg { margin-top: 4px; font: 500 18px var(--font-h); color: #fff4d4; text-shadow: 0 2px 4px #000, 0 0 10px #000; }
.invites { position: fixed; left: 50%; top: 112px; display: flex; flex-direction: column; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.invite { position: relative; display: flex; align-items: center; gap: 10px; width: min(350px, calc(100vw - 24px)); padding: 10px 12px 14px; overflow: hidden; pointer-events: auto; background: linear-gradient(180deg, rgba(40, 30, 22, .97), rgba(20, 15, 11, .97)); border-color: var(--gold); animation: popin .2s ease-out; }
.inv-port { display: grid; place-items: center; flex: none; width: 44px; height: 44px; color: var(--gold); }
.inv-port .portrait-img { width: 44px; height: 44px; border: 1px solid var(--gold); border-radius: 50%; background: #1a120c; image-rendering: pixelated; }
.inv-port .ico { width: 28px; height: 28px; }
.inv-main { flex: 1; min-width: 0; }
.inv-text { font: 400 14px var(--font-h); }
.inv-text b { color: var(--gold-hi); font-weight: 600; }
.inv-main small { display: block; color: var(--muted); font-size: 12px; }
.inv-acts { display: flex; gap: 6px; margin-top: 6px; }
.inv-acts .btn { flex: 1; }
.inv-timer { position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; background: linear-gradient(90deg, var(--verm-hi), var(--gold)); transform-origin: left; animation: timer 30s linear forwards; }
.conn-lost { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; pointer-events: auto; background: rgba(6, 4, 3, .8); -webkit-backdrop-filter: blur(3px) grayscale(.6); backdrop-filter: blur(3px) grayscale(.6); animation: fadein .3s; }
.conn-panel { width: min(420px, 100%); padding: 24px 24px 22px; text-align: center; }
.conn-ico { font-size: 42px; line-height: 1; color: var(--warn); }
.conn-title { margin: 8px 0 6px; font: 600 22px var(--font-h); color: var(--gold-hi); }
.conn-panel p { margin: 0 0 18px; line-height: 1.65; color: var(--muted); }

/* ---------------------------------------------------------------- อนิเมชัน */
@keyframes popin { from { opacity: 0; scale: .96; } to { opacity: 1; scale: 1; } }
@keyframes winin { from { opacity: 0; scale: .97; } to { opacity: 1; scale: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes toastin { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes drift { from { transform: translateX(-6%); } to { transform: translateX(6%); } }
@keyframes fall { from { transform: translate(0, -6vh); } to { transform: translate(var(--dx), 108vh); } }
@keyframes spin { from { transform: rotate(0) scaleX(1); } to { transform: rotate(240deg) scaleX(.35); } }
@keyframes twinkle { from { opacity: .45; } to { opacity: .85; } }
@keyframes birds { from { transform: translateX(-20vw); } to { transform: translateX(110vw); } }
@keyframes flap { from { transform: rotate(22deg); } to { transform: rotate(-12deg); } }
@keyframes flap2 { from { transform: rotate(-22deg); } to { transform: rotate(12deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 rgba(240, 210, 138, 0); } 50% { box-shadow: 0 0 14px rgba(240, 210, 138, .35); } }
@keyframes lowhp { from { filter: brightness(1); } to { filter: brightness(1.6); } }
@keyframes blink { 50% { opacity: .2; } }
@keyframes ring { 0%, 100% { opacity: .7; } 50% { opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes shakeS { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-2px, 1px); } 75% { transform: translate(2px, -1px); } }
@keyframes hammer { from { transform: rotate(-35deg); } to { transform: rotate(18deg); } }
@keyframes zoomin { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes spark { from { transform: rotate(var(--a)) translateY(-14px) scaleY(1); opacity: 1; } to { transform: rotate(var(--a)) translateY(-78px) scaleY(.3); opacity: 0; } }
@keyframes lbin { from { opacity: 0; transform: translate(-50%, -50%) scale(.4); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes lbout { from { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(-50%, -70%) scale(1.08); } }
@keyframes spinr { to { transform: rotate(360deg); } }
@keyframes timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) {
  .petals, .birds { display: none; }
  .mist, .stars, .lb-rays { animation: none; }
}

/* ---------------------------------------------------------------- จอกลาง (แท็บเล็ต/แล็ปท็อปเล็ก) */
@media (max-width: 1239px) {
  /* 2 คอลัมน์: ค่าสถานะย้ายไปอยู่ใต้รายละเอียดธาตุ */
  .create-main { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: 'left right' 'stats right'; grid-template-rows: auto 1fr; }
}
@media (max-width: 1180px) {
  .el-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cd-panel { grid-template-columns: 1fr; }
  .cd-wheel { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 16px; }
  .cd-wheel .el-rules, .cd-wheel .el-info { width: auto; flex: 1; min-width: 180px; }
}
@media (max-width: 960px) {
  .tab-stat-wrap { grid-template-columns: 200px 1fr; }
  .st-alloc { grid-column: 1 / -1; }
  .skill-wrap { grid-template-columns: minmax(0, 1fr) 240px; }
}
@media (max-width: 860px) {
  .create-main { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'left' 'stats' 'right'; grid-template-rows: none; }
}

/* ---------------------------------------------------------------- มือถือ */
@media (max-width: 720px) {
  #ui-root { font-size: 13px; }
  .btn, .btn-sm { min-height: 40px; }
  .hud-left { left: 6px; top: 6px; width: max(168px, min(240px, calc(100vw - 150px))); gap: 4px; }
  .hud-char { gap: 7px; padding: 6px 7px 6px 6px; }
  .hud-portrait { width: 46px; height: 46px; }
  .hud-lv { font-size: 10px; bottom: -6px; padding: 1px 4px; min-width: 32px; }
  .hud-name { font-size: 13px; }
  .hud-info { gap: 2px; }
  .hud-info .bar:not(.thin) { height: 13px; }
  .hud-info .bar-text { font-size: 9.5px; line-height: 11px; }
  .hud-bottom { min-height: 16px; font-size: 11.5px; flex-wrap: wrap; gap: 3px; }
  .hud-bottom .gold small { display: none; }
  .hud-pts { margin-left: 0; flex-wrap: wrap; }
  .pts-chip { font-size: 10px; padding: 0 6px; }
  .hud-map { display: none; }
  .hud-map-m { pointer-events: none; display: flex; flex-direction: column; padding: 3px 9px; background: rgba(16, 12, 9, .78); border-left: 2px solid var(--gold); border-radius: 0 4px 4px 0; }
  .hud-map-m b { font: 600 13px/1.25 var(--font-h); color: var(--gold-hi); }
  .hud-map-m span { font: 400 11px var(--font-h); color: var(--muted); }
  .hud-quests { max-height: 20vh; padding: 3px 8px 4px; font-size: 11.5px; }
  .hud-party { top: 150px; right: 6px; width: 136px; padding: 3px 6px 4px; }
  .hp-port, .hp-port .portrait-img { width: 26px; height: 26px; }
  .hp-name { font-size: 11.5px; }
  .hud-menu { right: 6px; bottom: calc(6px + var(--safe-b)); }
  .menu-btns { display: grid; grid-template-columns: repeat(3, 44px); gap: 3px; padding: 4px; }
  .menu-btn { width: 44px; height: 44px; }
  .menu-btn .ico { width: 19px; height: 19px; }
  .mb-label { font-size: 10px; }
  .menu-btn kbd { display: none; }
  .mb-badge { top: -5px; left: -5px; min-width: 17px; height: 17px; font-size: 10px; line-height: 17px; }
  .hud-online { flex-direction: column; align-items: flex-end; gap: 3px; font-size: 10px; }
  .hud-logout { min-height: 32px; padding: 0 8px; }
  .hud-logout > span:not(.ico) { display: none; }
  .hud-logout .ico { width: 16px; height: 16px; }
  .chat { left: 6px; bottom: calc(6px + var(--safe-b)); width: calc(100vw - 12px - 150px); min-width: 0; }
  .chat-log { height: 96px; font-size: 12px; padding: 3px 6px; }
  .chat-tab { padding: 2px 7px; font-size: 12px; min-height: 40px; }
  .chat-ch { min-width: 44px; }
  .chat-send { display: none; }
  .chat-input, .chat-ch { min-height: 36px; font-size: 16px; }
  .chat-ch { font-size: 11.5px; }
  .chat.in-battle { bottom: auto; top: max(calc(104px + env(safe-area-inset-top, 0px)), calc(var(--bt-hud-b, 0px) + 4px)); }   /* ใต้แผงปาร์ตี้ (public/js/battle.js computeForm · --bt-hud-b วัดจากขอบจอจริง รวมรอยบากแล้ว) */
  .chat.in-battle:not(.collapsed) { width: calc(100vw - 12px); }
  .chat.collapsed { width: auto; }
  .chat.collapsed .chat-tabs { display: none; }
  .chat-toggle, .chat-min { width: 40px; height: 40px; }
  .win-close { width: 40px; height: 40px; }

  .window, .window.dragged { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100% !important; transform: none; border-radius: 12px 12px 0 0; padding-bottom: var(--safe-b); }
  .char-win { height: 90vh; height: 90dvh; }
  .npc-win { max-height: 90vh; max-height: 90dvh; }
  .npc-win.expanded { height: 90vh; height: 90dvh; }
  .window.pop-in { animation: sheetin .22s ease-out; }
  .win-head { border-radius: 12px 12px 0 0; padding-left: 42px; cursor: default; }
  .win-tabs { gap: 2px; padding: 6px 4px 0; overflow-x: auto; }
  .win-tab { flex-direction: column; gap: 1px; min-width: 52px; min-height: 48px; padding: 4px 2px; font-size: 11.5px; }
  .win-tab kbd { display: none; }
  .win-body { padding: 10px 10px; }
  .tab-stat-wrap { grid-template-columns: 1fr; gap: 12px; }
  .st-profile { display: grid; grid-template-columns: 96px 1fr; grid-template-areas: 'p n' 'p c' 'm m' 'e e'; text-align: left; gap: 4px 12px; align-items: center; }
  .big-portrait { grid-area: p; width: 92px; height: 92px; }
  .st-name { grid-area: n; margin: 0; align-self: end; }
  .st-chips { grid-area: c; justify-content: flex-start; align-self: start; }
  .st-meta { grid-area: m; }
  .st-exp { grid-area: e; }
  .st-logout { grid-column: 1 / -1; justify-self: end; margin-top: 0; }
  .st-alloc { order: -1; }
  .dv-grid { grid-template-columns: 1fr 1fr; }
  .al-row { grid-template-columns: 1fr auto 40px 40px; }
  .btn-plus { width: 40px; height: 40px; }

  /* สกิล: รายการย่อหน้าตามลำดับขั้น + รายละเอียดติดด้านล่าง */
  .win-body.tab-skill { overflow-y: auto; display: block; padding: 8px 8px 0; }
  .skill-wrap { display: flex; flex-direction: column; gap: 8px; }
  .sk-left { display: block; }
  .sk-bar { margin-bottom: 8px; }
  .sk-legend { display: none; }
  .sk-trees { overflow: visible; padding-right: 0; }
  .sk-tree { display: flex; flex-direction: column; gap: 5px; }
  .sk-lines { display: none; }
  .sk-node { margin: 0 0 0 calc(var(--depth) * 18px); min-height: 52px; padding-right: 50px; }
  .sk-node::before { content: ''; position: absolute; left: -12px; top: -6px; width: 10px; height: 32px; border-left: 2px solid rgba(201, 164, 92, .3); border-bottom: 2px solid rgba(201, 164, 92, .3); border-radius: 0 0 0 6px; display: none; }
  .sk-node:not([data-depth="0"])::before { display: block; }
  .skn-plus { width: 40px; height: 40px; margin-top: -20px; font-size: 20px; }
  .sk-detail { position: sticky; bottom: 0; z-index: 3; gap: 6px; max-height: 40vh; max-height: 40dvh; margin: 0 -8px; padding: 10px; background: linear-gradient(180deg, #2a2017, #15100c); border-radius: 10px 10px 0 0; box-shadow: 0 -8px 20px rgba(0, 0, 0, .7); }
  .skd-ico, .skd-ico.sk-img { width: 40px; height: 40px; }
  .skd-name { font-size: 16px; }
  .skd-block { padding: 5px 8px; }

  .win-body.tab-inv { overflow-y: auto; display: block; }
  .inv-wrap { grid-template-columns: 1fr; height: auto; }
  .eq-doll { grid-template-columns: minmax(0, 1fr) 112px minmax(0, 1fr); max-width: 420px; margin: 0 auto; width: 100%; }
  .eq-name { min-height: 2.5em; -webkit-line-clamp: 2; }   /* มือถือ: หน้าต่างเลื่อนได้ แสดงชื่อเต็ม 2 บรรทัด */
  .inv-gold { margin-top: 8px; }
  .inv-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .inv-scroll { overflow: visible; }
  .pm-card { grid-template-columns: 48px 1fr; }
  .pm-port, .pm-port .portrait-img { width: 48px; height: 48px; }
  .pm-acts { grid-column: 1 / -1; flex-direction: row; }
  .pm-acts .btn { flex: 1; }
  .npc-top { gap: 10px; padding: 10px 12px 8px; }
  .npc-port { width: 64px; height: 64px; }
  .npc-name { font-size: 17px; }
  .npc-speech { min-height: 0; padding: 8px 22px 8px 10px; font-size: 13.5px; }
  .npc-opts { gap: 5px; padding: 2px 10px 10px; }
  .npc-opt { padding: 0 11px; font-size: 13px; }
  .npc-opt.bye { margin-left: 0; }
  .npc-panel { padding: 8px 10px 10px; }
  .npc-quests, .refine { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .nq-list, .rf-list { max-height: 30vh; }
  .shop-row { grid-template-columns: 46px 1fr; }
  .sr-buy { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .shop-row.sr-compact { grid-template-columns: 46px 1fr auto; gap: 8px; }
  .shop-row.sr-compact .sr-buy { grid-column: auto; flex-direction: column; align-items: flex-end; justify-content: center; }
  .sr-info { white-space: normal; }
  .stepper .step-b { width: 40px; height: 40px; }
  .step-in { height: 40px; min-height: 40px; font-size: 16px; }
  .fchip { min-height: 36px; }
  .toasts { top: auto; bottom: calc(206px + var(--safe-b)); }
  .toast { font-size: 13px; padding: 6px 22px; }
  .invites { top: 34vh; }
  .lb-rays { width: 380px; height: 380px; margin: -190px 0 0 -190px; }

  .create-wrap { padding: 8px 10px 20px; justify-content: flex-start; }
  .create-head { gap: 26px; margin-bottom: 6px; }
  .ch-text h1 { font-size: 20px; }
  .ch-text p { display: none; }
  .create-head .logo-seal { display: none; }
  .logo-sm .logo-main span { font-size: 26px; }
  .create-left > .copt-title small { display: block; font-size: 11.5px; }
  .el-grid { gap: 8px; }
  .el-card { padding: 8px 9px 10px; gap: 4px; }
  .ec-emblem { width: 38px; height: 38px; }
  .ec-emblem i { font-size: 19px; }
  .ec-names b { font-size: 17px; }
  .ec-names small { display: none; }
  .ec-role { font-size: 11.5px; }
  .ec-skills .ec-sk { width: 20px; height: 20px; }
  .cd-panel { padding: 10px 12px 12px; }
  .create-stats { padding: 10px 12px 12px; }
  .ca-row { grid-template-columns: minmax(0, 1fr) 40px 40px 40px; padding-left: 8px; }
  .ca-btn { width: 40px; height: 40px; }
  .ca-preset { min-height: 44px; }
  .ca-dv > div { padding: 4px 7px; }
  .cs-skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cd-wheel { flex-direction: column; }
  .wheel { width: 184px; height: 184px; }
  .cp-stage { height: 176px; }
  .cr-row { grid-template-columns: 48px 1fr; }
  .create-ok { position: sticky; bottom: 8px; z-index: 3; box-shadow: 0 6px 18px rgba(0, 0, 0, .7); }
  .login-center { justify-content: flex-start; padding-top: 12vh; }
  .logo-seal { right: -16px; width: 38px; height: 38px; font-size: 28px; line-height: 38px; }
  .tree { width: 60vmin; }
}
@media (max-width: 400px) {
  .chat { width: calc(100vw - 12px - 146px); }
  .chat-tab { padding: 2px 5px; }
  .swatch { width: 36px; height: 36px; }
  .seg-btn { min-height: 40px; font-size: 14px; }
}
@media (max-height: 560px) and (min-width: 721px) {
  .chat-log { height: 110px; }
  .hud-quests { max-height: 30vh; }
}
@media (max-height: 820px) and (min-width: 861px) {
  .create-head { margin-bottom: 4px; }
  .create-head .logo-sm .logo-main span { font-size: 28px; }
  .ch-text h1 { font-size: 22px; }
  .cd-desc { margin: 2px 0 4px; font-size: 13px; line-height: 1.5; }
  .cp-stage { height: 170px; }
  .cp-canvas { width: 176px; height: 165px; }
  .create-wrap { padding-top: 6px; padding-bottom: 12px; }
  .cd-facts { margin-bottom: 6px; }
  .cd-note { margin-bottom: 6px; padding: 4px 10px; }
  .cs-skills { gap: 4px; }
  .cs-skill { padding: 3px 6px; }
  .create-stats { gap: 6px; padding-top: 10px; padding-bottom: 12px; }
  .ca-rows { gap: 3px; }
  .ca-row { padding-top: 2px; padding-bottom: 2px; }
  .ca-dv > div { padding: 2px 7px; }
}
@keyframes sheetin { from { transform: translateY(30%); opacity: 0; } to { transform: none; opacity: 1; } }
.st-advice { --c: var(--gold); margin-top: 12px; padding: 10px 12px; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 14%, rgba(0, 0, 0, .3)), rgba(0, 0, 0, .3)); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); border-radius: 8px; }
.sta-new { margin-bottom: 8px; padding: 6px 10px; font: 500 13px/1.5 var(--font-h); color: #fff4d0; background: linear-gradient(90deg, rgba(182, 60, 47, .55), rgba(182, 60, 47, .1)); border-left: 3px solid #ffd27a; border-radius: 0 4px 4px 0; animation: glow 2s ease-in-out infinite; }
.sta-new b { font-size: 16px; color: #ffd27a; }
.sta-title { margin-bottom: 6px; font: 600 13px var(--font-h); color: var(--c); }
.sta-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.sta-chip { padding: 1px 8px; font: 400 12px var(--font-h); color: var(--text2); background: rgba(0, 0, 0, .35); border: 1px solid rgba(201, 164, 92, .25); border-radius: 10px; }
.sta-chip b { color: var(--cream); }
.st-advice .btn { width: 100%; }

/* ================================================================ v0.5 — แท็บธาตุในหน้าสกิล · ขุนพล · กรอบขุนพลบน HUD */
/* ---- กล่องยืนยันแบบมีช่องพิมพ์ (ตั้งชื่อขุนพล) */
.ask-field { display: flex; flex-direction: column; gap: 4px; }
.ask-field > span { font: 500 12.5px var(--font-h); color: var(--muted); }
.ask-err { min-height: 18px; font-size: 12px; color: var(--bad); }

/* ---- หน้าสกิล: แท็บธาตุ (ธาตุหลัก → ข้างเคียง ×2 → ทั่วไป → ตรงข้าม) */
.skt-tabs { position: relative; z-index: 1; display: flex; gap: 4px; margin-bottom: -8px; }
.skt { --c: var(--gold); position: relative; display: flex; flex: 1 1 0; align-items: center; gap: 7px; min-width: 0; min-height: 50px; padding: 5px 8px; text-align: left; color: var(--muted); background: linear-gradient(180deg, #241b14, #16110d); border: 1px solid rgba(201, 164, 92, .25); border-bottom: 0; border-radius: 8px 8px 0 0; cursor: pointer; transition: color .15s, background .15s; }
.skt::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: 0; height: 2px; border-radius: 2px; background: transparent; }
.skt:hover { color: var(--cream); background: linear-gradient(180deg, #2e231a, #1a140f); }
.skt.active { color: var(--cream); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 26%, #2a1f16), color-mix(in srgb, var(--c) 8%, #1a130e)); border-color: color-mix(in srgb, var(--c) 70%, var(--gold-lo)); }
.skt.active::after { background: var(--c); box-shadow: 0 0 8px var(--c); }
.skt-ico { display: grid; flex: none; place-items: center; width: 28px; height: 28px; font-size: 15px; font-style: normal; line-height: 1; border-radius: 50%; background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--c) 60%, #fff 5%), color-mix(in srgb, var(--c) 22%, #000) 80%); border: 1px solid var(--c); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 45%, transparent); }
.skt-main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.skt-main b { overflow: hidden; font: 600 13.5px/1.2 var(--font-h); white-space: nowrap; text-overflow: ellipsis; color: inherit; }
.skt.active .skt-main b { color: color-mix(in srgb, var(--c) 65%, #fff); text-shadow: 0 1px 2px #000; }
.skt-main small { display: block; overflow: hidden; font: 400 10.5px/1.3 var(--font-h); white-space: nowrap; text-overflow: ellipsis; color: var(--dim); }
.skt-main .skt-c { font-weight: 500; color: #9fd0ff; }
.skt.adj .skt-k { color: #e8c8a0; }
.skt.adj .skt-c { color: #ffb86b; }
.skt.opp { filter: grayscale(.55); opacity: .72; }
.skt.opp .skt-c { color: var(--bad); }
.skt.opp.active { filter: grayscale(.25); opacity: 1; }
.skt-ico { position: relative; }
.skt-lock { position: absolute; right: -5px; bottom: -4px; display: grid; place-items: center; width: 15px; height: 15px; color: #ffb0a0; background: #2a0f0c; border: 1px solid #a5503e; border-radius: 50%; }
.skt-lock .ico { width: 9px; height: 9px; }
.skt-dot { position: absolute; top: -7px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; font: 700 10.5px/18px var(--font-h); font-style: normal; text-align: center; color: #fff; background: #2f6fd0; border-radius: 9px; box-shadow: 0 0 0 2px rgba(0, 0, 0, .6), 0 0 8px #4a9aff; }
.sk-trees { --c: var(--gold); padding: 10px 8px 4px; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 8%, rgba(0, 0, 0, .3)), rgba(0, 0, 0, .18) 160px); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--gold-lo)); border-radius: 0 0 8px 8px; }
.sk-trees.opp .sk-tree { filter: saturate(.5); }
.skt-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; padding: 6px 10px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 18%, transparent), transparent 85%); border-left: 3px solid var(--c); border-radius: 0 4px 4px 0; }
.skt-head > i { font-size: 20px; font-style: normal; line-height: 1.25; }
.skt-head-main { min-width: 0; }
.skt-head b { font: 600 15px var(--font-h); color: var(--c); text-shadow: 0 1px 2px #000; }
.skt-kind { display: inline-block; margin-left: 8px; padding: 0 8px; font: 500 11px/1.6 var(--font-h); color: #9fd0ff; border: 1px solid rgba(127, 182, 255, .55); border-radius: 10px; vertical-align: 1px; }
.skt-head.adj .skt-kind { color: #ffb86b; border-color: rgba(255, 184, 107, .6); background: rgba(255, 150, 60, .1); }
.skt-head.common .skt-kind { color: var(--gold-hi); border-color: var(--gold-lo); }
.skt-head.opp .skt-kind { color: var(--bad); border-color: rgba(255, 123, 107, .6); background: rgba(255, 90, 60, .08); }
.skt-head small { font: 400 12px var(--font-h); color: var(--muted); }
.skt-head p { margin: 2px 0 0; font-size: 12px; line-height: 1.45; color: var(--text2); }
.skt-head.opp p { color: #ffb0a0; }
/* ป้ายแต้มต่อเลเวลที่มุมไอคอนสกิล (ฟ้า = 1, ส้ม = 2, แดง = เรียนไม่ได้) */
.skn-cost { position: absolute; left: -6px; top: -6px; z-index: 1; min-width: 16px; height: 16px; padding: 0 3px; font: 700 10.5px/14px var(--font-h); text-align: center; color: #0c1a2e; background: linear-gradient(180deg, #d8ecff, #7fb6ff); border: 1px solid #1d3a66; border-radius: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.skn-cost.c2 { color: #2a1200; background: linear-gradient(180deg, #ffe0b0, #ff9a3c); border-color: #6a3410; }
.skn-cost.c0 { color: #fff; background: linear-gradient(180deg, #c8503e, #6e1e1e); border-color: #300; }
.lg-cost::before { background: linear-gradient(180deg, #d8ecff, #7fb6ff) !important; border-radius: 50% !important; }
.sk-node.opp { cursor: help; padding-right: 8px; opacity: .55; }
.sk-node.opp .skn-ico .sk-img { filter: grayscale(1) brightness(.65); }
.tt-cost { margin: 3px 0; font: 500 12px var(--font-h); color: #9fd0ff; }
.tt-cost.c2 { color: #ffb86b; } .tt-cost.c0 { color: var(--bad); }
.skd-cost { display: flex; align-items: center; gap: 10px; padding: 6px 9px; background: rgba(80, 140, 255, .08); border: 1px solid rgba(127, 182, 255, .35); border-radius: 6px; }
.skd-cost-n { display: grid; flex: none; place-items: center; width: 30px; height: 30px; font: 700 16px var(--font-h); color: #0c1a2e; background: radial-gradient(circle at 40% 35%, #eef6ff, #7fb6ff); border: 1px solid #1d3a66; border-radius: 50%; }
.skd-cost b { display: block; font: 600 13px var(--font-h); color: #cfe6ff; }
.skd-cost small { font-size: 11.5px; color: var(--muted); }
.skd-cost.c2 { background: rgba(255, 150, 60, .09); border-color: rgba(255, 170, 90, .45); }
.skd-cost.c2 .skd-cost-n { color: #2a1200; background: radial-gradient(circle at 40% 35%, #fff0d8, #ff9a3c); border-color: #6a3410; }
.skd-cost.c2 b { color: #ffcf8f; }
.skd-cost.c0 { background: rgba(255, 90, 60, .08); border-color: rgba(255, 123, 107, .4); }
.skd-cost.c0 .skd-cost-n { color: #fff; background: radial-gradient(circle at 40% 35%, #e0705e, #6e1e1e); border-color: #300; }
.skd-cost.c0 b { color: var(--bad); }
.skd-learn-c { margin-left: 2px; padding: 0 8px; font: 600 12px/1.6 var(--font-h); color: #d8ecff; background: rgba(0, 0, 0, .35); border-radius: 9px; }

/* ---- กระเป๋า: ป้ายอาหารขุนพล */
.badge-pet { position: absolute; right: 2px; top: 2px; width: 14px; height: 14px; color: #8fe0c8; filter: drop-shadow(0 0 2px #000) drop-shadow(0 0 1px #000); pointer-events: none; }
.badge-pet .ico { width: 100%; height: 100%; }

/* ---- แท็บขุนพล */
.win-body.tab-pet { overflow: hidden; display: flex; flex-direction: column; }
.pet-wrap { display: grid; flex: 1; grid-template-columns: 330px minmax(0, 1fr); gap: 14px; min-height: 0; }
.pet-side { display: flex; flex-direction: column; min-height: 0; }
.pet-side .sec-title { align-items: center; }
.pet-food { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; font: 500 12.5px var(--font-h); color: var(--cream); }
.pf-ico, .pet-food .item-img { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; }
.pet-food .item-fb { font-size: 13px; }
.pet-cards { display: flex; flex: 1; flex-direction: column; gap: 6px; min-height: 0; padding: 4px 4px 2px 4px; }
.pet-card { --c: var(--gold); position: relative; display: flex; flex: none; align-items: center; gap: 10px; padding: 7px 9px; background: linear-gradient(180deg, #2a2119, #17110d); border: 1px solid #4a3c2c; border-left: 3px solid var(--c); border-radius: 8px; cursor: pointer; outline: none; transition: border-color .15s, box-shadow .15s; }
.pet-card:hover { border-color: var(--gold); border-left-color: var(--c); }
.pet-card:focus-visible { box-shadow: 0 0 0 2px var(--gold-hi); }
.pet-card.active { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 14%, #2a2119), #17110d); }
.pet-card.sel { border-color: #fff3c4; border-left-color: var(--c); box-shadow: 0 0 0 1px var(--gold-hi), 0 0 14px rgba(240, 210, 138, .35); }
.pet-card.down .pc-ico .mon-img { filter: grayscale(1) brightness(.6); }
.pc-ico { position: relative; display: grid; flex: none; place-items: center; width: 52px; height: 52px; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 30%, #2a1f16), #120d09 75%); border: 1px solid color-mix(in srgb, var(--c) 55%, #000); border-radius: 50%; }
.pc-ico .mon-img { width: 44px; height: 44px; object-fit: contain; image-rendering: pixelated; }
.pc-ico .mon-fb { border-radius: 50%; font-size: 22px; }
.pc-star { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 20px; height: 20px; font-size: 13px; line-height: 1; color: #ffd84a; background: #3a2410; border: 1px solid #ffd84a; border-radius: 50%; text-shadow: 0 0 6px #ffb000; box-shadow: 0 0 8px rgba(255, 200, 60, .6); }
.pc-main { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.pc-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pc-name b { overflow: hidden; font: 600 14.5px/1.2 var(--font-h); white-space: nowrap; text-overflow: ellipsis; color: var(--cream); }
.pet-card.active .pc-name b { color: var(--gold-hi); }
.pc-act, .pc-down { flex: none; padding: 0 7px; font: 600 10.5px/1.6 var(--font-h); border-radius: 8px; }
.pc-act { color: #2a1a00; background: linear-gradient(180deg, #ffe28a, #d8a032); }
.pc-down { color: #fff; background: #6e1e1e; border: 1px solid #a5503e; }
.pc-sub { display: flex; align-items: baseline; gap: 8px; min-width: 0; font: 500 11.5px var(--font-h); color: var(--muted); }
.pc-lv { color: var(--cream); }
.pc-sub small { overflow: hidden; color: var(--dim); white-space: nowrap; text-overflow: ellipsis; }
.pc-main .bar { height: 13px; }
.pc-main .bar-text { font-size: 10px; line-height: 11px; }
.pet-card.empty { cursor: default; padding: 5px 9px; background: rgba(0, 0, 0, .18); border-style: dashed; border-left-width: 1px; border-color: rgba(201, 164, 92, .3); opacity: .7; }
.pet-card.empty:hover { border-color: rgba(201, 164, 92, .3); }
.pet-card.empty .pc-ico { width: 36px; height: 36px; color: var(--gold-lo); background: none; border: 1px dashed var(--gold-lo); }
.pet-card.empty .pc-ico .ico { width: 16px; height: 16px; }
.pet-card.empty .pc-main { gap: 1px; }
.pet-card.empty .pc-main span { font: 500 12.5px var(--font-h); color: var(--muted); }
.pet-card.empty small { font-size: 11px; line-height: 1.4; color: var(--dim); }
.pet-full { padding: 6px 9px; font-size: 11.5px; text-align: center; color: #ffd08a; background: rgba(255, 169, 64, .08); border: 1px dashed rgba(255, 169, 64, .45); border-radius: 8px; }
.pd-note.tip { font-size: 11.5px; color: var(--muted); border-left-color: rgba(201, 164, 92, .3); background: rgba(0, 0, 0, .15); }
.pet-hint { margin-top: 8px; font-size: 11.5px; line-height: 1.5; text-align: center; color: var(--dim); }
/* แถบความภักดี: เขียว ≥60 · ส้ม 20–59 · แดง <20 (ขีดแบ่งที่ 20 และ 60) */
.loy { --lc: #6fe08a; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.loy.warn { --lc: #ffa940; } .loy.bad { --lc: #ff5a4a; }
.loy-l { display: inline-flex; flex: none; align-items: center; gap: 3px; font: 500 11px var(--font-h); color: var(--lc); }
.loy-l .ico { width: 13px; height: 13px; }
.loy-l .ico svg, .hpet-loy .ico svg { fill: currentColor; fill-opacity: .35; }
.loy-bar { position: relative; flex: 1; min-width: 60px; height: 11px; overflow: hidden; background: rgba(0, 0, 0, .6); border: 1px solid #000; border-radius: 3px; box-shadow: 0 0 0 1px rgba(201, 164, 92, .25); }
.loy-bar::before, .loy-bar::after { content: ''; position: absolute; top: 0; bottom: 0; z-index: 1; width: 1px; background: rgba(255, 255, 255, .3); }
.loy-bar::before { left: 20%; } .loy-bar::after { left: 60%; }
.loy-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--lc) 50%, #000), var(--lc)); transition: width .35s ease; }
.loy-bar b { position: relative; z-index: 2; display: block; font: 600 9.5px/9px var(--font-h); text-align: center; color: #fff; text-shadow: 0 0 2px #000, 0 1px 1px #000, 0 0 3px #000; }
.loy-warn { flex-basis: 100%; font: 500 11px/1.3 var(--font-h); color: var(--lc); }
.loy.bad .loy-warn { animation: pulse 1.4s infinite; }
/* รายละเอียดขุนพล */
.pet-detail { --c: var(--gold); display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 14px; background: linear-gradient(180deg, rgba(42, 32, 23, .9), rgba(18, 13, 10, .92)); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--gold-lo)); border-radius: 8px; }
.pd-top { display: flex; align-items: center; gap: 14px; }
.pd-stage { position: relative; display: grid; flex: none; place-items: center; width: 132px; height: 132px; overflow: hidden; background: radial-gradient(circle at 50% 62%, color-mix(in srgb, var(--c) 34%, #2a1f16), #0f0b08 75%); border: 2px solid color-mix(in srgb, var(--c) 70%, var(--gold-lo)); border-radius: 10px; box-shadow: 0 0 0 3px #000, inset 0 0 22px rgba(0, 0, 0, .6); }
.pd-glow { position: absolute; left: 50%; bottom: 16px; width: 86px; height: 16px; margin-left: -43px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .6), transparent); }
.pd-mon { position: relative; width: 104px; height: 104px; object-fit: contain; image-rendering: pixelated; animation: bob 2.4s ease-in-out infinite; }
.pd-mon.mon-fb { width: 80px; height: 80px; font-size: 44px; border-radius: 50%; }
.pd-ribbon { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 0; font: 600 11.5px var(--font-h); text-align: center; color: #2a1a00; background: linear-gradient(180deg, #ffe28a, #d8a032); }
.pd-info { display: flex; flex: 1; flex-direction: column; gap: 6px; min-width: 0; }
.pd-name { overflow: hidden; font: 600 22px/1.2 var(--font-h); white-space: nowrap; text-overflow: ellipsis; color: var(--gold-hi); text-shadow: 0 1px 3px #000; }
.pd-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.pd-bars { display: flex; flex-direction: column; gap: 4px; }
.pd-bars .bar { height: 16px; }
.pd-info .loy-bar { height: 15px; }
.pd-info .loy-bar b { font-size: 10.5px; line-height: 13px; }
.pd-info .loy-l { font-size: 12px; }
.pd-sec { padding: 8px 10px; background: rgba(0, 0, 0, .28); border: 1px solid rgba(201, 164, 92, .18); border-radius: 6px; }
.pd-sec .skd-label small { font-weight: 400; color: var(--dim); }
.pd-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 8px; margin-top: 4px; }
.pd-skills { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.pd-skill { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; padding: 4px 8px; background: rgba(255, 255, 255, .035); border-radius: 4px; }
.pd-skill b { font: 600 13px var(--font-h); color: var(--cream); }
.pd-skill small { font-size: 12px; color: var(--text2); }
.pd-skill em { font: 500 11px var(--font-h); font-style: normal; color: var(--muted); white-space: nowrap; }
.pd-skill.none { display: flex; align-items: baseline; margin-top: 4px; }
.pd-acts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pd-acts .btn { min-height: 44px; padding: 6px 8px; }
.pd-acts .pd-food, .pd-acts .item-img { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; }
.pd-acts .item-fb { font-size: 13px; }
.pd-food-n { padding: 0 6px; font: 600 11.5px/1.6 var(--font-h); font-style: normal; background: rgba(0, 0, 0, .35); border-radius: 8px; }
.pd-food-n.zero { color: #ffb0a0; }
.pd-notes { display: flex; flex-direction: column; gap: 4px; }
.pd-note { padding: 5px 9px; font-size: 12px; line-height: 1.5; color: var(--text2); background: rgba(0, 0, 0, .25); border-left: 3px solid var(--gold-lo); border-radius: 0 4px 4px 0; }
.pd-note.bad { color: #ffb0a0 !important; border-left-color: var(--bad); }
.pd-note.warn { color: #ffd08a; border-left-color: #ffa940; }
.pd-note.dim { font-size: 11.5px; }
/* ยังไม่มีขุนพล: วิธีจับ */
.pet-empty { max-width: 660px; margin: 0 auto; padding: 4px 6px; text-align: center; color: var(--muted); }
.pe-art { position: relative; display: grid; place-items: center; width: 96px; height: 96px; margin: 2px auto 8px; background: radial-gradient(circle at 50% 45%, #4a3828, #140e0a 72%); border: 1px solid var(--gold-lo); border-radius: 50%; box-shadow: 0 0 0 3px rgba(0, 0, 0, .5); }
.pe-mon { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 2px 2px #000); }
.pe-mon.mon-fb { border-radius: 50%; font-size: 30px; }
.pe-net { position: absolute; inset: 8px; z-index: 1; color: rgba(255, 216, 74, .6); pointer-events: none; }
.pe-net .ico { width: 100%; height: 100%; }
.pe-title { display: block; font: 600 19px var(--font-h); color: var(--cream); }
.pe-lead { max-width: 500px; margin: 4px auto 12px; line-height: 1.6; }
.pe-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; text-align: left; }
.pe-steps li { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; background: linear-gradient(135deg, rgba(201, 164, 92, .1), rgba(0, 0, 0, .25)); border: 1px solid rgba(201, 164, 92, .3); border-radius: 8px; }
.pe-steps i { display: grid; flex: none; place-items: center; width: 24px; height: 24px; font: 700 13px var(--font-h); font-style: normal; color: #fff; background: radial-gradient(circle at 40% 35%, #cc4e3c, #6a1c1c); border: 1px solid var(--gold); border-radius: 50%; }
.pe-steps b { display: block; font: 600 13.5px/1.3 var(--font-h); color: var(--gold-hi); }
.pe-steps small { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.pe-rules { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 12px; }
.pe-rules .chip { padding: 3px 10px; font-size: 12px; }
.pe-chance { max-width: 420px; margin: 0 auto 10px; padding: 8px 12px; text-align: left; background: rgba(0, 0, 0, .28); border: 1px solid rgba(201, 164, 92, .2); border-radius: 8px; }
.pe-rate { display: grid; grid-template-columns: 90px 1fr 40px; align-items: center; gap: 8px; margin: 3px 0; font-size: 12px; }
.pe-rate b { font: 600 12.5px var(--font-h); text-align: right; color: var(--gold-hi); }
.pe-rate-bar { height: 8px; overflow: hidden; background: rgba(0, 0, 0, .6); border-radius: 4px; box-shadow: 0 0 0 1px rgba(201, 164, 92, .25); }
.pe-rate-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8a6418, #ffd84a); }
.pe-foot { max-width: 540px; margin: 0 auto; line-height: 1.6; }

/* ---- HUD: กรอบขุนพลที่ออกรบ (ใต้กรอบตัวละคร) */
.hud-pet { --elc: var(--gold); pointer-events: auto; display: flex; align-items: center; align-self: flex-start; gap: 7px; width: 214px; min-height: 44px; padding: 4px 9px 4px 5px; font: inherit; text-align: left; color: var(--cream); border-left: 3px solid var(--elc); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.hud-pet:hover { border-color: var(--gold); border-left-color: var(--elc); box-shadow: 0 0 10px rgba(201, 164, 92, .35); }
.hpet-ico { position: relative; display: grid; flex: none; place-items: center; width: 36px; height: 36px; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--elc) 30%, #2a1f16), #120d09 75%); border: 1px solid var(--elc); border-radius: 50%; }
.hpet-ico .mon-img { width: 30px; height: 30px; object-fit: contain; image-rendering: pixelated; }
.hpet-ico .mon-fb { width: 30px; height: 30px; font-size: 16px; border-radius: 50%; }
.hud-pet.down .hpet-ico .mon-img { filter: grayscale(1) brightness(.6); }
.hpet-info { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.hpet-top { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.hpet-name { overflow: hidden; font: 600 12.5px/1.2 var(--font-h); white-space: nowrap; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.hpet-lv { flex: none; font: 500 11px var(--font-h); color: var(--muted); }
.hpet-loy { display: inline-flex; flex: none; align-items: center; gap: 2px; margin-left: auto; font: 600 11px var(--font-h); color: #6fe08a; }
.hpet-loy .ico { width: 12px; height: 12px; }
.hpet-loy.warn { color: #ffa940; }
.hpet-loy.bad { color: #ff5a4a; animation: pulse 1.2s infinite; }
.hud-pet .bar { height: 12px; }
.hud-pet .bar-text { font-size: 9.5px; line-height: 10px; }

/* ---- หน้าสร้างตัวละคร: สายสกิลที่เรียนได้ */
.cd-trees { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 0 0 8px; }
.ct-label { margin-right: 2px; font: 500 12px var(--font-h); color: var(--muted); }
.ct-chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px 1px 5px; background: color-mix(in srgb, var(--c) 12%, rgba(0, 0, 0, .3)); border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); border-radius: 10px; }
.ct-chip i { font-size: 11px; font-style: normal; }
.ct-chip b { font: 600 12px var(--font-h); color: var(--c); }
.ct-chip small { font: 600 10.5px var(--font-h); color: #9fd0ff; }
.ct-chip.adj small { color: #ffb86b; }
.ct-chip.opp { filter: grayscale(.6); opacity: .7; border-style: dashed; }
.ct-chip.opp small { color: var(--bad); }

@media (max-width: 960px) {
  .pet-wrap { grid-template-columns: 280px minmax(0, 1fr); }
  .pd-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pd-acts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .ask-input { font-size: 16px; }
  /* สกิล: แท็บธาตุเป็นตาราง 2 คอลัมน์ (ธาตุตรงข้ามเป็นแถบเต็มด้านล่าง) */
  .skt-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-bottom: 6px; }
  .skt { min-height: 48px; padding: 4px 8px; border-bottom: 1px solid rgba(201, 164, 92, .25); border-radius: 8px; }
  .skt.active { border-color: color-mix(in srgb, var(--c) 70%, var(--gold-lo)); }
  .skt.opp { grid-column: 1 / -1; min-height: 40px; }
  .skt-ico { width: 26px; height: 26px; font-size: 14px; }
  .skt-main { display: block; }
  .skt-main b { display: block; font-size: 13px; }
  .skt-main small { display: inline; }
  .skt-main .skt-c::before { content: ' · '; color: var(--dim); }
  .sk-trees { padding: 8px 6px 6px; border-radius: 8px; }
  .skt { min-height: 44px; }
  .sk-bar { padding: 5px 10px; gap: 4px 10px; }
  .sk-pts b { font-size: 22px; }
  .sk-detail { max-height: 36vh; max-height: 36dvh; }
  .skt-head { padding: 5px 8px; }
  .skt-head p { font-size: 11.5px; }
  .skt-kind { margin-left: 0; margin-top: 2px; }
  .skn-cost { left: -5px; top: -5px; }
  .skd-cost { padding: 5px 8px; }
  /* ขุนพล: รายการด้านบน รายละเอียดด้านล่าง */
  .win-body.tab-pet { overflow-y: auto; display: block; }
  .pet-wrap { display: flex; flex-direction: column; gap: 10px; }
  .pet-cards { overflow: visible; padding: 4px 2px 2px; }
  .pet-card { min-height: 64px; }
  .pet-card.empty { min-height: 44px; }
  .pet-detail { overflow: visible; padding: 10px; }
  .pd-top { gap: 10px; align-items: flex-start; }
  .pd-stage { width: 96px; height: 96px; }
  .pd-mon { width: 80px; height: 80px; }
  .pd-name { font-size: 18px; }
  .pd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pd-skill { grid-template-columns: auto auto minmax(0, 1fr); }
  .pd-skill small { grid-column: 1 / -1; }
  .pd-skill em { grid-row: 1; grid-column: 3; justify-self: end; }
  .pe-steps { grid-template-columns: 1fr; }
  .pe-lead { font-size: 13px; }
  /* HUD */
  .hud-pet { align-self: stretch; width: auto; min-height: 40px; padding: 3px 7px 3px 4px; gap: 6px; }
  .hpet-ico { width: 32px; height: 32px; }
  .hpet-ico .mon-img { width: 26px; height: 26px; }
  .hpet-name { font-size: 12px; }
  .hud-pet .bar { height: 11px; }
  .hud-pet .bar-text { font-size: 9px; line-height: 9px; }
}

/* ---------------------------------------------------------------- ขุนพลบุคคล (v0.8) — ทำเนียบขุนพล / แท็บขุนพล / HUD */
.badge-bad { color: #ffd0c8; background: rgba(160, 40, 30, .35); border-color: rgba(255, 107, 90, .45); }
/* HUD กรอบขุนพลที่ออกรบ */
.hpet-ico .portrait-img { width: 34px; height: 34px; object-fit: cover; object-position: 50% 18%; border-radius: 50%; }
.hud-pet.down .hpet-ico .portrait-img { filter: grayscale(1) brightness(.6); }
.hud-pet.gen .hpet-info { gap: 2px; }
.hud-pet.gen .bar.bar-mp { height: 7px; }
.hud-pet.gen .bar.bar-mp .bar-text { display: none; }
/* แท็บขุนพล */
.pc-ico .portrait-img { width: 48px; height: 48px; object-fit: cover; object-position: 50% 15%; border-radius: 50%; }
.pet-card.down .pc-ico .portrait-img { filter: grayscale(1) brightness(.6); }
.pc-sub small.pc-gen { color: #f0d28a; }
.pc-main .bar.bar-mp { height: 9px; }
.pc-main .bar.bar-mp .bar-text { font-size: 8.5px; line-height: 8px; }
.gen-stage .pd-gen { position: relative; width: 124px; height: 124px; object-fit: contain; animation: bob 2.4s ease-in-out infinite; }
.gen-ts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin: 6px 0 2px; }
.gen-ts-c { display: flex; flex-direction: column; align-items: center; padding: 3px 2px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(201, 164, 92, .2); border-radius: 4px; }
.gen-ts-c small { font: 500 10.5px var(--font-h); color: var(--muted); }
.gen-ts-c b { font: 600 15px/1.2 var(--font-h); color: var(--cream); }
.pd-skill.gen-skill { grid-template-columns: auto auto minmax(0, 1fr) auto; }
.gen-skill .gsk-ico, .gd-skill .gd-sk { width: 32px; height: 32px; border-radius: 6px; }
.gen-skill .gsk-lv { font: 500 11px var(--font-h); color: var(--gold); }
/* ขุนพล v8: ปุ่มอัพสกิล · แต้มสกิล · อุปกรณ์ 7 ช่อง · รายการเลือกของ (charwin.js petEquip / pickPetGear) */
.pd-skill .gsk-lv { font: 500 11px var(--font-h); color: var(--gold); }
.psk-pts { font: 600 12px var(--font-h); color: var(--good); }
.psk-up { min-height: 22px; margin-left: 6px; padding: 0 8px; font-weight: 700; }
.pg-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.pg-item { display: flex; align-items: center; justify-content: flex-start; gap: 6px; text-align: left; }
.pg-item .item-img { width: 24px; height: 24px; }
.pg-item small { margin-left: auto; color: var(--muted); }
.pd-acts.gen-acts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pe-lead.pe-gen { margin-top: 10px; padding: 8px 12px; color: var(--text2); background: rgba(201, 164, 92, .08); border: 1px dashed rgba(201, 164, 92, .4); border-radius: 8px; }
.pe-gen b { color: var(--gold-hi); }
/* ทำเนียบขุนพล (หน้าต่าง NPC) */
.npc-win.gen-mode { width: min(940px, calc(100vw - 24px)); }
.npc-win.gen-mode.expanded { height: min(720px, calc(100vh - 60px)); }
.gen-panel { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.gen-bar { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.gen-tabs { display: flex; flex-wrap: wrap; gap: 5px; }
.gen-tab { --c: var(--gold); display: inline-flex; align-items: center; gap: 2px; }
.gen-tab.active { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, #3a2a1c), color-mix(in srgb, var(--c) 25%, #1a120c)); }
.gen-tab small { color: var(--dim); }
.gen-tab.active small { color: #f3e6c8; }
.gen-open { margin-left: 4px; padding: 0 6px; font: 600 10.5px/1.55 var(--font-h); font-style: normal; color: #10200f; background: #7fe08a; border-radius: 8px; }
.gen-only { display: inline-flex; align-items: center; gap: 4px; font: 500 12px var(--font-h); color: var(--muted); cursor: pointer; }
.gen-slots { display: inline-flex; align-items: center; gap: 3px; font: 600 12.5px var(--font-h); color: var(--cream); }
.gen-slots .ico { width: 15px; height: 15px; color: var(--gold); }
.npc-quests.gen-body { flex: 1; grid-template-columns: 290px 1fr; }
.gen-item { min-height: 52px; }
.gen-ico { display: grid; flex: none; place-items: center; width: 44px; height: 44px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #4a3828, #120d09 75%); border: 1px solid rgba(201, 164, 92, .45); border-radius: 50%; }
.gen-ico .portrait-img { width: 44px; height: 44px; object-fit: cover; object-position: 50% 15%; }
.gen-ph { display: block; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .06); }
.gen-item small { display: flex; align-items: center; gap: 8px; }
/* v1.4 ทำเนียบขุนพล = สมุดรายชื่อ + ที่พเนจร (จ้างไม่ได้แล้ว) */
.gen-where { display: inline-flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; color: #9fe8a8; white-space: nowrap; text-overflow: ellipsis; }
.gen-where .ico { flex: none; width: 12px; height: 12px; }
.gen-item small > span:first-child { flex: none; }
.gen-item.low, .gen-item.st-closed { opacity: .55; }
.gen-item.st-owned { border-color: rgba(240, 210, 138, .55); }
.gen-item.st-wander b { color: #b8f5c0; }
.gen-item.st-wander:not(.sel) { border-color: rgba(111, 224, 138, .35); }
.gen-rot { font: 500 12px var(--font-h); color: var(--muted); white-space: nowrap; }
.gen-detail-npc { --c: var(--gold); }
.gd-head { display: flex; align-items: center; gap: 12px; }
.gd-stage { display: grid; flex: none; place-items: center; width: 108px; height: 108px; overflow: hidden; background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--c) 34%, #2a1f16), #0f0b08 75%); border: 2px solid color-mix(in srgb, var(--c) 70%, var(--gold-lo)); border-radius: 10px; box-shadow: 0 0 0 2px #000; }
.gd-stage .portrait-img { width: 100px; height: 100px; object-fit: contain; }
.gd-stage .gen-ph { width: 70px; height: 70px; }
.gd-info { display: flex; flex: 1; flex-direction: column; gap: 5px; min-width: 0; }
.gd-name { font: 600 21px/1.2 var(--font-h); color: var(--gold-hi); text-shadow: 0 1px 3px #000; }
.gd-name small { font: 400 12.5px var(--font-h); color: var(--muted); }
.gd-loc { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text2); }
.gd-loc .ico { width: 14px; height: 14px; color: var(--gold); }
.gd-cap { margin-top: 2px; padding: 4px 8px; font-size: 12.5px; }
.gd-where { margin-top: 10px; padding: 8px 10px; background: rgba(0, 0, 0, .22); border: 1px solid color-mix(in srgb, var(--c) 35%, rgba(201, 164, 92, .25)); border-radius: 8px; }
.gd-where .sec-sub { margin-top: 0; }
.gw-now { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; font-size: 13px; background: rgba(255, 255, 255, .03); border: 1px solid rgba(201, 164, 92, .18); border-radius: 6px; }
.gw-now .ico { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--gold); }
.gw-now span { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.gw-now .gw-walk { flex: none; align-self: center; min-height: 34px; padding: 4px 14px; }
.gw-now .gw-walk .ico { width: 15px; height: 15px; margin: 0; color: inherit; }
.gw-now b { font: 600 14px/1.35 var(--font-h); color: var(--cream); }
.gw-now small { font-size: 12px; color: var(--muted); }
.gw-now.on { background: rgba(80, 200, 120, .1); border-color: rgba(80, 200, 120, .4); }
.gw-now.on .ico, .gw-now.on b { color: #9ff0b0; }
.gw-now.off .ico, .gw-now.off b { color: #ffb09a; }
.gw-maps { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.gw-map { display: inline-flex; align-items: baseline; gap: 5px; padding: 2px 9px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(201, 164, 92, .25); border-radius: 12px; }
.gw-map b { font: 500 12.5px var(--font-h); color: var(--cream); }
.gw-map small { font-size: 11px; color: var(--gold); }
.gw-map.on { background: rgba(111, 224, 138, .12); border-color: #4a8a5a; }
.gw-map.on b { color: #b8f5c0; }
.gd-derived { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 8px; margin-top: 6px; }
.gd-skills { display: flex; flex-wrap: wrap; gap: 6px; }
.gd-skill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(201, 164, 92, .22); border-radius: 18px; }
.gd-skill .gd-sk { width: 28px; height: 28px; }
.gd-skill b { font: 500 13px var(--font-h); color: var(--cream); }
.gd-skill small { font: 500 11px var(--font-h); color: var(--gold); }
.gd-how { display: block; margin-top: 7px; font-size: 12px; line-height: 1.45; }
@media (max-width: 720px) {
  .npc-win.gen-mode .npc-top { padding: 8px 12px 6px; gap: 10px; align-items: center; }
  .npc-win.gen-mode .npc-port { width: 56px; height: 56px; }
  .npc-win.gen-mode .npc-speech { display: none; }
  .npc-win.gen-mode .npc-who { margin-bottom: 0; }
  .npc-win.gen-mode .npc-opts { padding-bottom: 6px; }
  .npc-win.gen-mode .npc-opt { min-height: 34px; }
  .gen-tabs { flex-wrap: nowrap; width: 100%; }
  .gen-tab { flex: 1; justify-content: center; min-height: 32px; padding: 2px 4px; font-size: 12.5px; }
  .gen-tab small { display: none; }
  .gen-open { margin-left: 3px; padding: 0 5px; }
  .npc-quests.gen-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .gen-list { max-height: 27vh; }
  .gen-ts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gd-derived { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gd-stage { width: 84px; height: 84px; }
  .gd-stage .portrait-img { width: 78px; height: 78px; }
  .pd-acts.gen-acts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gen-bar .spacer { display: none; }
  .gen-bar .gen-slots { display: none; }   /* ช่องเต็มแสดงในบรรทัด "จับได้ไหม" ของรายละเอียดแล้ว */
  .gw-now { flex-wrap: wrap; }
  .gw-now .gw-walk { flex: 1 1 100%; }
}

/* ---------------------------------------------------------------- คัทซีนหลังฝ่าด่าน (cutscene.js) — แถบดำบน-ล่าง · ชื่อจุดข้าม · ขุนพลที่แพ้พูด */
body.cutscene #ui-root, body.cutscene #minimap { opacity: 0; transition: opacity .35s; pointer-events: none !important; }
#ui-root, #minimap { transition: opacity .35s; }
.cs-root { position: fixed; inset: 0; z-index: 9000; cursor: pointer; user-select: none; -webkit-user-select: none; font-family: var(--font-h); color: var(--cream); }
.cs-vig { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 46%, transparent 40%, rgba(8, 4, 2, .55) 100%); opacity: 0; transition: opacity .5s; }
.cs-bar { position: absolute; left: 0; right: 0; height: 12vh; background: #050302; transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.cs-bar.top { top: 0; transform: translateY(-100%); box-shadow: 0 2px 0 rgba(201, 164, 92, .35); }
.cs-bar.bot { bottom: 0; transform: translateY(100%); box-shadow: 0 -2px 0 rgba(201, 164, 92, .35); }
.cs-root.on .cs-bar { transform: none; }
.cs-root.on .cs-vig { opacity: 1; }
.cs-root.closing .cs-bar.top { transform: translateY(-100%); }
.cs-root.closing .cs-bar.bot { transform: translateY(100%); }
.cs-root.closing .cs-vig { opacity: 0; }
.cs-root.gone { opacity: 0; transition: opacity .4s; }
.cs-title { position: absolute; left: 0; right: 0; top: 24vh; text-align: center; opacity: 0; transform: scale(.92); transition: opacity .5s, transform .9s cubic-bezier(.2, .8, .2, 1); pointer-events: none; }
.cs-title.on { opacity: 1; transform: none; }
.cs-title.off { opacity: 0; transform: scale(1.04); transition: opacity .45s, transform .45s; }
.cs-title small { display: block; font: 500 clamp(14px, 2.2vw, 20px) var(--font-h); letter-spacing: .2em; color: var(--gold-hi); text-shadow: 0 2px 6px #000; }
.cs-title b { display: block; margin-top: 4px; font: 700 clamp(30px, 6vw, 62px)/1.15 var(--font-h); letter-spacing: .04em;
  background: linear-gradient(180deg, #fff3c8 10%, #f0d28a 45%, #b8862e 90%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #3a2410) drop-shadow(0 0 18px rgba(0, 0, 0, .8)); }
.cs-title b::before, .cs-title b::after { content: '✦'; display: inline-block; margin: 0 .4em; font-size: .45em; vertical-align: middle; color: var(--gold); -webkit-text-fill-color: var(--gold); }
.cs-talk { position: absolute; left: 50%; bottom: calc(12vh + 18px); width: min(640px, calc(100vw - 32px)); transform: translate(-50%, 16px); display: flex; gap: 14px; align-items: center;
  padding: 12px 16px; background: linear-gradient(180deg, rgba(36, 24, 16, .94), rgba(18, 12, 8, .94)); border: 1px solid var(--gold-lo); border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .45), 0 10px 30px rgba(0, 0, 0, .6); opacity: 0; transition: opacity .35s, transform .35s; pointer-events: none; }
.cs-talk.on { opacity: 1; transform: translate(-50%, 0); }
.cs-talk .cs-face { flex: none; width: 76px; height: 76px; border-radius: 50%; border: 2px solid var(--gold); background: radial-gradient(circle at 50% 35%, #4a3828, #140e0a 75%); object-fit: cover; }
.cs-say { min-width: 0; }
.cs-say b { display: block; font: 600 16px var(--font-h); color: var(--gold-hi); }
.cs-line { margin: 4px 0 0; min-height: 2.6em; font: 400 16px/1.45 var(--font-b); color: var(--cream); }
.cs-hint { position: absolute; left: 0; right: 0; bottom: 18vh; text-align: center; font: 600 clamp(15px, 2.4vw, 20px) var(--font-h); color: var(--gold-hi);
  text-shadow: 0 2px 4px #000, 0 0 12px rgba(0, 0, 0, .9); opacity: 0; transition: opacity .4s; pointer-events: none; }
.cs-hint.on { opacity: 1; }
.cs-skip { position: absolute; right: 16px; bottom: calc(12vh + 6px); transform: translateY(100%); font: 500 12px var(--font-h); color: rgba(240, 210, 138, .75); letter-spacing: .05em; }
@media (max-width: 640px) {
  .cs-talk { padding: 10px 12px; gap: 10px; }
  .cs-talk .cs-face { width: 58px; height: 58px; }
  .cs-line { font-size: 14.5px; }
  .cs-title { top: 20vh; }
}
@media (prefers-reduced-motion: reduce) {
  .cs-bar, .cs-title, .cs-talk { transition: opacity .3s; }
}

/* ---------------------------------------------------------------- ฝากขุนพล (npc.js pstorePanel) */
.ps-panel { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.ps-note { margin: 0; font-size: 12.5px; color: var(--dim); }
.ps-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-height: 0; }
.ps-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 8px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(201, 164, 92, .25); border-radius: 8px; }
.ps-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; }
.ps-row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px; padding: 4px 6px; background: rgba(255, 255, 255, .04); border-radius: 6px; }
.ps-ico { position: relative; width: 40px; height: 40px; }
.ps-ico .pc-star { position: absolute; right: -4px; top: -4px; font-size: 12px; color: #ffd860; text-shadow: 0 1px 2px #000; }
.ps-who { min-width: 0; }
.ps-who b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 600 13.5px var(--font-h); }
.ps-who small { color: var(--dim); font-size: 11.5px; }
.ps-who .loy-good { color: #8fe08f; } .ps-who .loy-warn { color: #ffd060; } .ps-who .loy-bad { color: #ff8a7a; }
/* ---------------------------------------------------------------- คลังของ (npc.js storagePanel) · ปุ่มขยายกระเป๋า/คลัง (ไปร้านแคช) */
.st-panel { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.st-panel .inv-grid { grid-template-columns: repeat(5, 1fr); }
.st-scroll { max-height: 380px; padding: 2px; }
.inv-more { margin-left: 6px; min-height: 0; padding: 1px 8px; font-size: 12px; }
@media (max-width: 640px) { .ps-cols { grid-template-columns: 1fr; } .ps-list { max-height: 200px; } }

/* ---------------------------------------------------------------- กิลด์ (ui/guild.js) · หาปาร์ตี้ (ui/lfg.js) */
.chat-tab.active[data-ch=guild], .chat-ch[data-ch=guild], .ch-guild { color: #8fd0ff; }
.pm-head small.pm-guild { display: block; color: #9fd2f0; }
.guild-wrap { display: flex; flex-direction: column; gap: 10px; }
.gd-req { font-size: 13px; }
.gd-req .ok, .lfg-meta .ok { color: #9fe07a; }
.gd-req .bad, .lfg-meta .bad, .ps-note.bad { color: #ff9a7a; }
.gd-head { display: flex; align-items: center; gap: 12px; }
.gd-emblem { display: grid; flex: none; place-items: center; width: 48px; height: 48px; color: var(--gold-hi); background: radial-gradient(circle, #3a2a1c, #18110c); border: 1px solid var(--gold); border-radius: 50%; }
.gd-emblem .ico { width: 26px; height: 26px; }
.gd-title b { display: block; font: 700 19px var(--font-h); color: var(--gold-hi); }
.gd-title small { font-size: 12.5px; color: var(--muted); }
.gd-notice-mini { display: flex; align-items: flex-start; gap: 6px; padding: 6px 10px; font-size: 13px; color: var(--cream); background: rgba(143, 208, 255, .07); border: 1px solid rgba(143, 208, 255, .3); border-radius: 6px; white-space: pre-wrap; }
.gd-notice-mini .ico { flex: none; width: 16px; height: 16px; margin-top: 2px; color: #8fd0ff; }
.gd-sec { display: flex; flex-direction: column; gap: 8px; }
.gd-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gd-list { display: flex; flex-direction: column; gap: 4px; }
.gd-mem { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; padding: 7px 10px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(201, 164, 92, .22); border-radius: 6px; }
.gd-mem.me { border-color: var(--gold); }
.gd-mem.off { opacity: .72; }
.gd-dot { width: 9px; height: 9px; border-radius: 50%; background: #6a6058; }
.gd-mem.on .gd-dot { background: #6fe08a; box-shadow: 0 0 6px #6fe08a; }
.gd-who b { font: 600 14.5px var(--font-h); color: var(--cream); }
.gd-who small { font-size: 12px; color: var(--muted); }
.gd-who > small { display: block; }
.gd-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
/* เพื่อน/จดหมาย (ui/social.js) */
.ml-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 10px; min-height: 0; }
.ml-list { display: flex; flex-direction: column; gap: 3px; max-height: 360px; overflow-y: auto; }
.ml-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 9px; text-align: left; color: var(--cream); background: rgba(0, 0, 0, .25); border: 1px solid rgba(201, 164, 92, .22); border-radius: 6px; cursor: pointer; }
.ml-row.sel { border-color: var(--gold); background: rgba(201, 164, 92, .12); }
.ml-dot { width: 7px; height: 7px; border-radius: 50%; }
.ml-row.unread .ml-dot { background: #8fd0ff; box-shadow: 0 0 5px #8fd0ff; }
.ml-main { display: flex; flex-direction: column; min-width: 0; }
.ml-main b { overflow: hidden; font: 500 13.5px var(--font-h); text-overflow: ellipsis; white-space: nowrap; }
.ml-row.unread .ml-main b { font-weight: 700; color: var(--gold-hi); }
.ml-main small { overflow: hidden; font-size: 11.5px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.ml-read { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 10px 12px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(201, 164, 92, .22); border-radius: 6px; }
.ml-read.empty { align-items: center; justify-content: center; color: var(--dim); font-style: italic; }
.ml-head b { display: block; font: 600 15px var(--font-h); color: var(--gold-hi); overflow-wrap: anywhere; }
.ml-head small { font-size: 12px; color: var(--muted); }
.ml-text { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--cream); white-space: pre-wrap; overflow-wrap: anywhere; }
.ml-att { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ml-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.ml-compose { display: flex; flex-direction: column; gap: 6px; min-width: min(420px, 78vw); }
.ml-textarea { min-height: 76px; resize: vertical; font: inherit; }
.ml-attach { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; }
.ml-att-item { display: inline-flex; align-items: center; gap: 3px; }
.ml-att-item .qty-input { width: 58px; }
.ml-pick { display: flex; flex-wrap: wrap; gap: 4px; max-height: 150px; overflow-y: auto; padding: 4px; background: rgba(0, 0, 0, .25); border-radius: 6px; }
.ml-rule { margin: 0; font-size: 12px; }
@media (max-width: 700px) { .ml-cols { grid-template-columns: 1fr; } .ml-list { max-height: 220px; } }
.gd-perm { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--cream); cursor: pointer; }
.gd-notice { margin: 0 0 6px; font-size: 14px; line-height: 1.6; color: var(--cream); white-space: pre-wrap; overflow-wrap: anywhere; }
.gd-edit { margin-left: auto; }
.gd-log { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.gd-log-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 3px 4px; font-size: 13px; border-bottom: 1px solid rgba(201, 164, 92, .12); }
.gd-log-row small { min-width: 78px; color: var(--dim); }
.gd-log-row b { color: var(--gold-hi); font-weight: 600; }
.br-acts { display: flex; flex-direction: column; gap: 8px; }
.lfg-board { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.lfg-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.lfg-fit { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.lfg-list { display: flex; flex-direction: column; gap: 4px; }
.lfg-row { display: grid; grid-template-columns: minmax(110px, 1.1fr) 1.4fr auto auto; align-items: center; gap: 10px; padding: 7px 10px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(201, 164, 92, .22); border-radius: 6px; }
.lfg-row.mine { border-color: var(--gold); background: rgba(201, 164, 92, .06); }
.lfg-goal b { display: block; font: 600 13.5px var(--font-h); color: var(--gold-hi); }
.lfg-goal span, .lfg-who small, .lfg-meta small { display: block; font-size: 12px; color: var(--muted); }
.lfg-who b { font: 600 14px var(--font-h); color: var(--cream); }
.lfg-meta { text-align: right; font: 600 13px var(--font-h); }
.lfg-form { display: flex; flex-direction: column; gap: 10px; min-width: min(420px, 80vw); }
.lfg-f-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lfg-f-row > span:first-child { min-width: 76px; font-size: 13px; color: var(--muted); }
.lfg-f-row .input { flex: 1 1 80px; width: auto; min-width: 0; }
@media (max-width: 640px) {
  .lfg-row { grid-template-columns: 1fr auto; }
  .lfg-meta { text-align: left; }
  .gd-mem { grid-template-columns: 10px 1fr; }
  .gd-acts { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ---------------------------------------------------------------- เควสรายวัน · รางวัลล็อกอิน · ความสำเร็จ/ฉายา (ui/progress.js) */
.daily-wrap { margin-bottom: 12px; }
.daily-wrap .sec-title { align-items: center; }
.daily-login { margin-left: auto; }
.daily-login.notify, .hud-daily.notify, .hud-events.notify { box-shadow: 0 0 0 2px rgba(255, 207, 90, .75), 0 0 12px rgba(255, 207, 90, .45); }
.daily-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.daily-card { display: flex; flex-direction: column; gap: 5px; padding: 8px 10px; background: rgba(0, 0, 0, .28); border: 1px solid rgba(201, 164, 92, .3); border-radius: 6px; }
.daily-card.ready { border-color: rgba(159, 224, 122, .7); background: rgba(159, 224, 122, .08); }
.daily-card.got { opacity: .6; }
.dc-desc { font-size: 12.5px; color: var(--muted); }
.dc-acts { display: flex; gap: 6px; }
.lg-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 4px; }
.lg-day { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 92px; padding: 6px 3px; text-align: center; background: rgba(0, 0, 0, .3); border: 1px solid rgba(201, 164, 92, .3); border-radius: 6px; }
.lg-day b { font: 600 12px var(--font-h); color: var(--muted); }
.lg-day.today { border-color: var(--gold-hi); box-shadow: 0 0 10px rgba(255, 207, 90, .35); }
.lg-day.today b { color: var(--gold-hi); }
.lg-day.got { opacity: .55; }
.lg-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 4px; }
.lg-mark { position: absolute; top: 2px; right: 5px; font-weight: 800; color: #9fe07a; }
.pg-ico { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; vertical-align: middle; }
.pg-item, .pg-gold { display: inline-flex; align-items: center; font: 500 12px var(--font-h); color: var(--cream); }
.pg-rw { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.ach-wrap { display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 0; }
.ach-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ach-cur { display: flex; flex: 1; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--muted); }
.ach-list { flex: 1; min-height: 0; padding-right: 3px; }
.ach-cat { margin-bottom: 8px; }
.ach-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin-top: 4px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(201, 164, 92, .2); border-radius: 5px; }
.ach-row.own { background: rgba(159, 224, 122, .06); }
.ach-main { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.ach-name { font: 700 13.5px var(--font-h); }
.ach-main small { font-size: 12px; color: var(--muted); }
.ach-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
.pm-title { font-weight: 700; }
.pm-title.g-common { color: #f3e6c8; } .pm-title.g-uncommon { color: #8fe08f; } .pm-title.g-rare { color: #6fb8ff; } .pm-title.g-epic { color: #c890ff; } .pm-title.g-legend { color: #ff9a3c; }
@media (max-width: 700px) { .lg-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .ach-row { flex-wrap: wrap; } .ach-acts { width: 100%; justify-content: flex-start; } }
/* World Boss (ui/wboss.js): ป้ายนับถอยหลังใต้ชื่อแผนที่ + แผงเมนูกิจกรรม (ปุ่ม 🎪) · มือถือ: ใต้กรอบภารกิจ */
.wb-pill { position: absolute; z-index: 25; left: 50%; top: 60px; transform: translateX(-50%); display: none; align-items: center; gap: 6px; padding: 4px 14px; font: 600 13px var(--font-h); color: #ffe7b0; white-space: nowrap; background: rgba(60, 12, 8, .9); border: 1px solid rgba(255, 140, 90, .7); border-radius: 16px; cursor: pointer; pointer-events: auto; box-shadow: 0 0 10px rgba(255, 90, 40, .3); }
.wb-pill.on { display: inline-flex; }
.wb-pill.live { animation: wbGlow 1.6s ease-in-out infinite; }
@keyframes wbGlow { 50% { box-shadow: 0 0 22px rgba(255, 120, 60, .75); } }
@media (prefers-reduced-motion: reduce) { .wb-pill.live { animation: none; } }
.wb-panel { position: absolute; z-index: 25; left: 50%; top: 94px; transform: translateX(-50%); display: none; width: min(380px, 94vw); max-height: 70vh; overflow-y: auto; padding: 8px 12px 10px; pointer-events: auto; }
.wb-panel.on { display: block; }
.wb-panel.panel-lite { background: linear-gradient(180deg, #1a140f, #100c09); }   /* เมนูกิจกรรมทับ HUD/การ์ดมือใหม่บนมือถือ — ทึบ (โปร่งนิดเดียวตัวหนังสือข้างหลังก็ยังทะลุ) */
.wb-head { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; font: 600 14px var(--font-h); color: var(--gold-hi); }
.wb-head b { white-space: nowrap; }
.wb-head small { font: 400 11.5px var(--font-b, inherit); color: var(--muted); }
.wb-boss { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid rgba(201, 164, 92, .25); }
.wb-boss.over { opacity: .65; }
.wb-ico { width: 48px; height: 48px; object-fit: contain; }
.wb-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font: 600 14px var(--font-h); color: var(--cream); }
.wb-dead { color: #9fe07a; font-size: 12px; } .wb-fled { color: var(--dim); font-size: 12px; }
.wb-sub { font-size: 12px; color: var(--muted); }
.wb-hp { height: 8px; margin: 4px 0 2px; overflow: hidden; background: rgba(0, 0, 0, .55); border-radius: 4px; }
.wb-hp i { display: block; height: 100%; background: linear-gradient(90deg, #b5301e, #ff7a5a); }
.wb-top { margin: 4px 0 0; padding-left: 20px; font-size: 12px; color: var(--dim); }
.wb-top b { font-weight: 500; color: var(--cream); }
.wb-me { margin-top: 3px; font: 500 12.5px var(--font-h); color: #9fe07a; }
.wb-acts { margin-top: 5px; }
.wb-note { margin: 6px 0 0; font-size: 11.5px; color: var(--dim); }
.ev-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(201, 164, 92, .25); }
.ev-main { flex: 1; min-width: 0; }
.ev-main > b { font: 600 14px var(--font-h); color: var(--cream); }
.wb-cd { color: #ffd38a; font-weight: 500; }
/* ป้ายบนจอ: แถบ HP ก้อนรวมบางๆ ใต้ข้อความ (มีรอบกิจกรรม) · แผง: สิทธิ์บุก + เป้าดาเมจของเรา */
.wb-pill.hp { padding-bottom: 7px; }
.wb-pill-hp { display: none; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 3px; overflow: hidden; background: rgba(0, 0, 0, .6); border-radius: 2px; }
.wb-pill.hp .wb-pill-hp { display: block; }
.wb-pill-hp i { display: block; height: 100%; background: linear-gradient(90deg, #d8382a, #ff9a6a); }
.wb-me { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.wb-tries { color: #ffd38a; }
.wb-tries.none { color: #ff8a7a; }
.wb-goals { margin-top: 5px; }
.wb-goal-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 0; padding: 0; list-style: none; font-size: 11.5px; }
.wb-goal-list li { padding: 1px 7px; color: var(--dim); background: rgba(0, 0, 0, .35); border: 1px solid rgba(201, 164, 92, .25); border-radius: 9px; }
.wb-goal-list li.done { color: #1c1408; background: #9fe07a; border-color: #9fe07a; }
.wb-goal-list li.next { color: #ffd38a; border-color: rgba(255, 211, 138, .7); }
.wb-goal-bar i { background: linear-gradient(90deg, #b88a2a, #ffd38a); }
.wb-goal-done { color: #9fe07a; }
@media (max-width: 720px) { .wb-pill { top: calc(var(--safe-t, 0px) + 252px); } .wb-panel { top: calc(var(--safe-t, 0px) + 286px); max-height: 52vh; } }
/* ของขวัญต้อนรับ (ขุนพลซาลาเปา) */
.gift-card { display: flex; align-items: center; gap: 12px; }
.gift-card .gift-port { flex: none; width: 96px; height: 96px; border-radius: 12px; background: rgba(255, 200, 120, .12); }
.gift-card b { font: 700 17px var(--font-h); color: var(--gold-hi); }
.gift-card p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }

/* ---------------------------------------------------------------- เส้นทางมือใหม่ (ui/onboard.js): การ์ดติดตามใต้ภารกิจ · ไฮไลต์ปุ่ม · ส่วนในแท็บเควส */
.ob-card { pointer-events: auto; max-width: 300px; padding: 5px 10px 7px; font-size: 12.5px; }
.ob-head { display: flex; align-items: center; gap: 6px; font: 600 13px var(--font-h); color: var(--gold-hi); cursor: pointer; user-select: none; }
.ob-head span { flex: 1; }
.ob-card.collapsed .ob-body { display: none; }
.ob-name { margin-top: 3px; font: 600 13.5px var(--font-h); color: var(--cream); }
.ob-hint { margin-top: 2px; line-height: 1.45; color: var(--muted); }
.ob-wait { margin-top: 3px; color: var(--dim); }
.ob-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ob-spot { position: fixed; z-index: 9000; pointer-events: none; border: 3px solid #ffd27e; border-radius: 12px; box-shadow: 0 0 0 4px rgba(255, 210, 126, .3), 0 0 26px rgba(255, 210, 126, .65); animation: obPulse 1.1s ease-in-out infinite; }
.ob-spot-tip { position: absolute; top: calc(100% + 10px); left: 50%; width: max-content; max-width: min(280px, 80vw); padding: 6px 10px; font: 500 12.5px/1.45 var(--font-h); color: #1a1208; background: #ffd27e; border-radius: 8px; transform: translateX(-50%); box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
.ob-spot.up .ob-spot-tip { top: auto; bottom: calc(100% + 10px); }
.ob-spot.right .ob-spot-tip { left: auto; right: 0; transform: none; }
@keyframes obPulse { 50% { box-shadow: 0 0 0 9px rgba(255, 210, 126, .12), 0 0 34px rgba(255, 210, 126, .85); } }
@media (prefers-reduced-motion: reduce) { .ob-spot { animation: none; } }
.ob-sec { margin-bottom: 12px; }
.ob-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 3px 12px; margin: 0 0 6px; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
.ob-steps li { display: flex; align-items: baseline; gap: 6px; }
.ob-steps li.ok { color: #9fe07a; }
.ob-steps li.cur { color: var(--gold-hi); font-weight: 600; }
.ob-mark { min-width: 34px; font-size: 11.5px; }
@media (max-width: 700px) { .ob-card { max-width: 62vw; padding: 3px 8px 5px; font-size: 11.5px; } }

/* ---------------------------------------------------------------- เก็บสมุนไพร + ยาบัพ (herbs.js · npc.js brewPanel) */
.herb-prog { position: absolute; left: 50%; bottom: calc(150px + var(--safe-b, 0px)); z-index: 30; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 14px 8px; font: 600 13px var(--font-h); color: #e8ffe0; background: rgba(10, 24, 12, .78); border: 1px solid rgba(127, 208, 106, .6); border-radius: 8px; pointer-events: none; }
.herb-prog .hp-track { width: 150px; height: 6px; overflow: hidden; background: rgba(0, 0, 0, .5); border-radius: 3px; }
.herb-prog .hp-track i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #4fb84a, #b8f07a); border-radius: 3px; animation: herbFill linear forwards; }
@keyframes herbFill { to { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .herb-prog .hp-track i { animation-timing-function: steps(4); } }
.hud-buffs { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.hud-buffs:empty { display: none; }
.hud-buff { display: inline-flex; align-items: center; gap: 2px; padding: 0 5px 0 1px; font: 600 10.5px var(--font-h); color: #e8ffe0; background: rgba(40, 80, 40, .55); border: 1px solid rgba(127, 208, 106, .45); border-radius: 9px; }
.hud-buff.cu-stealth { color: #dffcf6; background: rgba(20, 80, 90, .6); border-color: rgba(143, 224, 208, .6); }   /* ยันต์พรางตา (cashutil.js) */
.hud-buff.cu-god { color: #fff1c0; background: rgba(110, 80, 10, .6); border-color: rgba(255, 210, 74, .6); }       /* เทพ EXP */
.hb-ico, .brew-ico { width: 18px; height: 18px; object-fit: contain; image-rendering: pixelated; vertical-align: middle; }
.brew-need { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; font-size: 12px; }
.brew-need .ok { color: #9fe07a; } .brew-need .bad { color: #ff9a7a; }
.brew-note { margin: 0 0 6px; font-size: 12px; }
