/* =====================================================================
   NEO MIDGARD — ธีมโฮโลแกรม: แผงกระจกเข้ม เส้นฟ้านีออน มุมตัดเฉียง
   ===================================================================== */
:root {
  color-scheme: dark;
  --bg0: #05080f;
  --glass: rgba(7, 13, 24, 0.78);
  --glass-2: rgba(12, 22, 40, 0.86);
  --panel: #0b1322; --panel-2: #111c30; --panel-3: #0a101c;
  --line: rgba(110, 200, 255, 0.20); --line-2: rgba(110, 200, 255, 0.34); --line-hi: #4fc6ff;
  --cy: #62e3ff; --cy-2: #2a9ee0; --cy-glow: rgba(98, 227, 255, 0.45);
  --ink: #e6f1fb; --ink-dim: #93a9c2; --ink-faint: #5a6d84;
  --hp-a: #ff3d62; --hp-b: #ff8a5c; --sp-a: #2f8bff; --sp-b: #6ee7ff; --exp: #ffd05a; --jexp: #b58cff;
  --ok: #5af0a0; --warn: #ffbf4d; --bad: #ff5a6a;
  --gold: var(--cy); --gold-hi: #d8f6ff; --blood: var(--bad); --moss: var(--ok); --ice: #8af0c8;
  --display: "Kanit", "Noto Sans Thai", "Segoe UI", sans-serif;
  --font: "Noto Sans Thai", "Kanit", Tahoma, "Segoe UI", sans-serif;
  --sr: env(safe-area-inset-right, 0px); --sl: env(safe-area-inset-left, 0px);
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --gap: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; height: 100dvh; overflow: hidden; background: var(--bg0); font-family: var(--font); color: var(--ink); }
body { user-select: none; -webkit-user-select: none; -webkit-text-size-adjust: 100%; overscroll-behavior: none; -webkit-touch-callout: none; }
/* ข้อความในเกมไม่ถูกลาก/คลุมดำ/กดค้างแล้วขึ้นเมนู (มือถือ) — ช่องพิมพ์ยังเลือกข้อความได้ */
* { -webkit-touch-callout: none; }
img:not([draggable="true"]) { -webkit-user-drag: none; user-drag: none; }
input, textarea, [contenteditable="true"] { user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
canvas#cv { position: fixed; inset: 0; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; color: inherit; }
button, .hb, .inv-cell, .eq-slot, .dlg-opt, #pad * { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hint { color: var(--ink-dim); font-size: 11px; margin-top: 6px; }
@keyframes pulse { 50% { filter: brightness(1.35); } }

/* ---------------- การ์ดยูนิต ---------------- */
#basic-info {
  position: fixed; left: calc(var(--gap) + var(--sl)); top: calc(var(--gap) + var(--st)); width: 312px;
  display: flex; gap: 10px; padding: 10px 12px 9px 10px; z-index: 20;
  background: linear-gradient(100deg, rgba(10,20,38,.92), rgba(7,13,24,.72) 70%, rgba(7,13,24,.35));
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  border-left: 2px solid var(--cy); box-shadow: inset 0 1px 0 var(--line-2);
}
#basic-info::after { content: ""; position: absolute; left: 0; right: 18px; top: 0; height: 1px; background: linear-gradient(90deg, var(--cy), transparent); }
.bi-face { position: relative; width: 64px; height: 72px; flex-shrink: 0; }
.bi-face canvas { width: 64px; height: 72px; display: block;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: #0a1426; }
.bi-face::before { content: ""; position: absolute; inset: -3px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(160deg, var(--cy), rgba(98,227,255,.1) 45%, var(--cy-2)); z-index: -1; }
.bi-face { isolation: isolate; }
.bi-face em { position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); min-width: 30px; padding: 1px 5px;
  font: 700 11px/14px var(--display); font-style: normal; text-align: center; color: #04121f;
  background: linear-gradient(var(--cy), var(--cy-2)); clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 50%, calc(100% - 5px) 100%, 5px 100%, 0 50%); }
.bi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.bi-id { display: flex; align-items: baseline; gap: 8px; min-width: 0; padding-right: 22px; position: relative; }
.bi-id b { font: 600 16px/1.2 var(--display); letter-spacing: .01em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0 10px var(--cy-glow); }
.bi-id span { font-size: 12px; font-weight: 600; color: var(--cy); letter-spacing: .02em; white-space: nowrap; }

.gauge { position: relative; height: 15px; background: rgba(0,0,0,.55); overflow: hidden;
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 100%, 0 100%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.gauge.sp { height: 11px; }
.gauge.thin { height: 4px; flex: 1; clip-path: none; background: rgba(255,255,255,.08); }
.gauge .fill { height: 100%; width: 0; transition: width .18s ease-out; position: relative; }
.gauge .fill::after { content: ""; position: absolute; inset: 0 0 50% 0; background: linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,0)); }
.gauge.hp .fill { background: linear-gradient(90deg, var(--hp-a), var(--hp-b)); box-shadow: 0 0 10px rgba(255,80,100,.6); }
.gauge.hp .fill.low { background: linear-gradient(90deg, #b0102a, var(--hp-a)); animation: pulse .9s infinite; }
.gauge.sp .fill { background: linear-gradient(90deg, var(--sp-a), var(--sp-b)); }
.gauge.exp .fill { background: var(--exp); box-shadow: 0 0 6px rgba(255,208,90,.7); }
.gauge.jexp .fill { background: var(--jexp); box-shadow: 0 0 6px rgba(181,140,255,.7); }
/* ขีดแบ่งทุก 10% */
.gauge.hp::before, .gauge.sp::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0,0,0,.35) calc(10% - 1px) 10%); }
.gauge i { position: absolute; left: 6px; top: 0; z-index: 2; font: 600 10px/15px var(--display); font-style: normal; color: rgba(255,255,255,.9); letter-spacing: .02em; }
.gauge.sp i { line-height: 11px; font-size: 8px; }
.gauge span { position: absolute; right: 12px; top: 0; z-index: 2; font: 600 11px/15px var(--font); color: #fff; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #000; }
.gauge.sp span { line-height: 11px; font-size: 10px; }
.bi-exp { display: flex; flex-direction: column; gap: 2px; margin-top: 1px; }
.xrow { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--ink-dim); }
.xrow label { width: 50px; font: 600 10px var(--display); letter-spacing: .02em; white-space: nowrap; }
.xrow label b { color: #fff; font-size: 10px; }
.xrow > span { width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.bi-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-height: 16px; font-size: 12px; font-weight: 600; color: var(--exp); }
#bi-zeny::before { content: "◈ "; color: var(--exp); }
#bi-zeny.has-ic::before { content: none; }
#bi-zeny img { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.pt { background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 7px; cursor: pointer; animation: pulse 1.2s infinite;
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }

#buffs { position: fixed; left: calc(var(--gap) + var(--sl)); top: calc(126px + var(--st)); display: flex; gap: 4px; flex-wrap: wrap; max-width: 300px; pointer-events: none; z-index: 20; }
/* แถบติดตามเควสต์ (ใต้การ์ดยูนิต) — แตะเพื่อนำทาง */
#quest-track { position: fixed; left: calc(var(--gap) + var(--sl)); top: calc(160px + var(--st)); z-index: 19; width: 250px; padding: 6px 10px 7px; cursor: pointer;
  background: linear-gradient(100deg, rgba(10,20,38,.85), rgba(7,13,24,.4)); border-left: 2px solid var(--gold, #ffd34a); color: var(--ink); font-size: 12.5px; }
#quest-track:hover { background: linear-gradient(100deg, rgba(20,34,58,.92), rgba(7,13,24,.5)); }
.qt-title { font-weight: 600; color: #ffe08a; display: flex; gap: 5px; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-obj { color: var(--ink-dim); margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.qt-bar { flex: 1; height: 4px; background: rgba(255,255,255,.12); max-width: 90px; }
.qt-bar i { display: block; height: 100%; background: #ffd34a; }
#hud.hud-min #quest-track { display: none; }
.q-card { border: 1px solid var(--line-2); padding: 10px 12px; background: rgba(0,0,0,.25); }
.q-card h4 { margin: 0 0 4px; color: #ffe08a; font-size: 15px; }
.q-card p { margin: 4px 0; }
.q-card .q-obj { color: var(--cy); font-weight: 600; }
.q-card .q-rw { color: var(--ink-dim); font-size: 12.5px; }
.q-done { margin-top: 10px; font-size: 12.5px; color: var(--ink-dim); display: grid; gap: 3px; }
.q-done b { color: #7fdc8f; font-weight: 500; }
.st-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.st-col { min-width: 0; }
.st-h { font-weight: 600; color: var(--cy); margin-bottom: 5px; display: flex; justify-content: space-between; }
.st-h small { color: var(--ink-dim); font-weight: 400; }
.st-pane { max-height: 300px; overflow-y: auto; align-content: start; }
@media (max-width: 520px) { .st-cols { grid-template-columns: 1fr; } .st-pane { max-height: 160px; } }
.shop-n .cmp-row { font-size: 11.5px; margin-top: 1px; }
.cmp-row { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.cmp-h { color: var(--ink-dim); }
.cmp { font-weight: 600; } .cmp.up { color: #7fdc8f; } .cmp.down { color: #ff8a7a; }
.wm-grid { position: relative; display: grid; gap: 14px; padding: 4px; }
.wm-links { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); pointer-events: none; }
.wm-links line { stroke: rgba(98,227,255,.55); stroke-width: 3; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.wm-card { position: relative; z-index: 1; min-height: 92px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 1px; padding: 8px 9px;
  background: #0d1624 center/cover no-repeat; border: 1px solid var(--line-2); color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.wm-card:hover { border-color: var(--cy); }
.wm-card.here { border-color: #ffd34a; box-shadow: 0 0 0 1px #ffd34a, 0 0 16px rgba(255,211,74,.35); cursor: default; }
.wm-card b { font-size: 13.5px; text-shadow: 0 1px 3px #000; }
.wm-card small { font-size: 11.5px; color: #bfe6ff; text-shadow: 0 1px 3px #000; }
.wm-tags { position: absolute; top: 6px; left: 6px; right: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.wm-tags i { font-style: normal; font-size: 10.5px; padding: 1px 6px; background: rgba(4,8,16,.8); border: 1px solid var(--line-2); }
.wm-here { color: #ffd34a; } .wm-mvp { color: #ff8a7a; } .wm-q { color: #ffe08a; }
.mb-head { display: flex; gap: 12px; align-items: center; }
.mb-cv { width: 96px; height: 96px; flex: none; background: radial-gradient(circle, #2a3448, #0a0f1a 75%); border: 1px solid var(--line-2); }
.mb-name { font-size: 17px; font-weight: 600; color: var(--ink); display: flex; gap: 6px; align-items: center; }
.mb-sub { font-size: 12.5px; color: var(--ink-dim); }
.mb-sub.bad { color: #ff9a8a; } .mb-sub.ok { color: #9fdcaf; }
.mb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; margin-top: 10px; font-size: 13px; }
.mb-kv { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line-2); padding: 2px 0; }
.mb-kv span { color: var(--ink-dim); }
.mb-h { margin-top: 10px; font-weight: 600; color: var(--cy); font-size: 13px; }
.mb-drops { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin-top: 4px; }
.mb-drop { display: flex; align-items: center; gap: 6px; font-size: 12.5px; min-width: 0; }
.mb-drop img { width: 24px; height: 24px; flex: none; }
.mb-drop span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-drop em { color: #ffd34a; font-style: normal; }
.mb-mvp { margin-top: 8px; padding: 6px 10px; background: rgba(120,20,20,.3); border-left: 2px solid #ffd05a; color: #ffe0a0; font-size: 13px; }
.mb-where { font-size: 12.5px; color: var(--ink); margin-top: 3px; }
.nav-info { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--cy); font-size: 17px; padding: 2px 6px; cursor: pointer; }
.nav-row { position: relative; }
.nav-row:has(.nav-info) { padding-right: 34px; }
.tg-info { margin-left: auto; color: var(--cy); font-size: 15px; padding: 0 4px; pointer-events: auto; cursor: pointer; }
.tg-info:hover { color: #fff; }
.emote-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.emote-b { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 2px; background: rgba(0,0,0,.25); border: 1px solid var(--line-2); color: var(--ink-dim); font: 11px var(--font); cursor: pointer; }
.emote-b:hover { border-color: var(--cy); color: var(--ink); }
.buff { width: 28px; height: 28px; background: var(--c); position: relative; text-align: center; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.buff b { font-size: 14px; line-height: 28px; color: #fff; text-shadow: 0 0 3px #000; }
.buff i { position: absolute; left: 0; right: 0; bottom: 1px; font: 700 8px var(--display); font-style: normal; color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000; }

/* ---------------- กรอบเป้าหมาย ---------------- */
#target { position: fixed; left: 50%; top: calc(var(--gap) + var(--st)); transform: translateX(-50%); z-index: 20; width: 280px; display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px; background: linear-gradient(90deg, rgba(40,8,14,.85), rgba(7,13,24,.75)); border-top: 1px solid rgba(255,90,106,.5); pointer-events: none;
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%, 0 10px); }
#target[hidden] { display: none; }
#tg-cv { width: 42px; height: 42px; flex-shrink: 0; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.tg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tg-id { display: flex; justify-content: space-between; gap: 8px; }
.tg-id b { font: 600 13px var(--display); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-id span { font-size: 11px; color: #ffb0b8; white-space: nowrap; }
#target .gauge { height: 11px; } #target .gauge span { line-height: 11px; font-size: 9.5px; }
#target.boss { border-top-color: #ffd05a; background: linear-gradient(90deg, rgba(70,10,10,.92), rgba(30,6,10,.8)); width: 340px; }
#target.boss .tg-id b { color: #ffd05a; }
.sicon.art { background: #0a1220; }
.sicon.art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bi-id span img { width: 20px; height: 20px; vertical-align: -5px; margin-right: 4px; object-fit: contain; filter: drop-shadow(0 0 4px rgba(0,0,0,.8)); }
#map-banner.has-img { width: min(820px, 94vw); aspect-ratio: 3 / 1.25; max-height: 44vh; padding: 0 20px 18px; display: flex; flex-direction: column; justify-content: flex-end;
  background-size: cover; background-position: center 45%; top: 16%;
  -webkit-mask-image: radial-gradient(ellipse 58% 62% at 50% 50%, #000 60%, transparent 100%); mask-image: radial-gradient(ellipse 58% 62% at 50% 50%, #000 60%, transparent 100%); }
#map-banner.has-img::before { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 45%, rgba(4,8,16,.75)); z-index: -1; }
#map-banner.has-img { isolation: isolate; }
#map-banner.has-img.show { animation: bannerImg 3.6s ease forwards; }
@keyframes bannerImg { 0% { opacity: 0; transform: translateX(-50%) scale(1.06); } 14% { opacity: 1; transform: translateX(-50%) scale(1); } 78% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) scale(.99); } }

/* ---------------- นำทาง ---------------- */
#nav-pill { position: fixed; left: 50%; top: calc(66px + var(--st)); transform: translateX(-50%); z-index: 21; display: flex; align-items: center; gap: 8px;
  padding: 5px 6px 5px 12px; font-size: 13px; color: #d8f6ff; background: rgba(6,14,28,.88); border: 1px solid var(--line-2); border-left: 3px solid var(--cy);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); max-width: min(92vw, 420px); }
#nav-pill[hidden] { display: none; }
#nav-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nav-cancel { width: 24px; height: 24px; padding: 0; border: 1px solid var(--line); background: rgba(0,0,0,.3); color: var(--ink-dim); font-size: 16px; line-height: 20px; }
#nav-cancel:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.nav-list { display: flex; flex-direction: column; gap: 4px; max-height: min(52vh, 420px); overflow-y: auto; }
.nav-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; padding: 7px 10px; background: rgba(14,26,46,.7); border: 1px solid var(--line); color: var(--ink); }
.nav-row:hover { border-color: var(--cy); background: rgba(98,227,255,.12); }
.nav-row.here { border-left: 3px solid var(--cy); }
.nav-n { font-weight: 600; }
.nav-s { font-size: 11px; color: var(--ink-dim); white-space: nowrap; }

/* ---------------- ปุ่มพับ ---------------- */
.fold-btn { position: absolute; top: 0; right: 0; width: 22px; height: 20px; padding: 0; z-index: 3; border: 0; background: transparent;
  color: var(--ink-dim); font-size: 11px; line-height: 20px; }
.fold-btn::before { content: "▾"; }
.folded > .fold-btn::before, .folded .bi-id .fold-btn::before { content: "▸"; }
.fold-btn:hover { color: var(--cy); }
#basic-info .fold-btn { top: -2px; right: -2px; }
#basic-info.folded .bi-exp, #basic-info.folded .bi-foot { display: none; }
#basic-info.folded { width: 250px; }
#basic-info.folded .bi-face, #basic-info.folded .bi-face canvas { width: 40px; height: 46px; }

/* ---------------- เรดาร์ ---------------- */
#minimap { position: fixed; right: calc(var(--gap) + var(--sr)); top: calc(var(--gap) + var(--st)); width: 164px; z-index: 20; display: flex; flex-direction: column; align-items: center; }
.mm-ring { position: relative; width: 156px; height: 156px; border-radius: 50%; padding: 4px;
  background: conic-gradient(from 200deg, var(--cy), rgba(98,227,255,.08) 25%, rgba(98,227,255,.08) 60%, var(--cy-2) 85%, var(--cy));
  box-shadow: 0 0 18px rgba(40,160,230,.35), 0 6px 18px rgba(0,0,0,.6); }
#minimap-cv { display: block; width: 100%; height: 100%; border-radius: 50%; background: #060a12; cursor: pointer; box-shadow: inset 0 0 18px rgba(0,0,0,.9); }
.mm-ring::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), inset 0 0 24px rgba(0,0,0,.6); }
.mm-n { position: absolute; left: 50%; top: -2px; transform: translateX(-50%); font: 700 9px/12px var(--display); color: #04121f; background: var(--cy); padding: 0 4px; border-radius: 3px; pointer-events: none; }
.mm-head { margin-top: 5px; display: flex; align-items: center; gap: 6px; max-width: 170px; padding: 2px 12px; background: var(--glass);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%); }
#map-name { font: 600 12px/16px var(--display); letter-spacing: .01em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-sub { font-size: 10px; color: var(--ink-dim); font-variant-numeric: tabular-nums; margin-top: 1px; text-shadow: 0 1px 2px #000; }
.mm-btn { position: absolute; width: 30px; height: 30px; border-radius: 50%; padding: 0; border: 1px solid var(--line-2); background: rgba(8,16,30,.92);
  color: var(--cy); font: 700 16px/1 var(--font); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.mm-btn svg { width: 16px; height: 16px; }
.mm-btn:hover { border-color: var(--cy); box-shadow: 0 0 10px var(--cy-glow); }
#map-open { left: -6px; top: 118px; }
#zoom-ctl button:nth-child(1) { left: -12px; top: 12px; }
#zoom-ctl button:nth-child(2) { left: -20px; top: 46px; }
#minimap .fold-btn { right: -4px; top: -4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(8,16,30,.9); border: 1px solid var(--line-2); }
#minimap.folded .mm-ring, #minimap.folded .mm-btn, #minimap.folded .mm-sub { display: none; }
#minimap.folded { width: auto; }
#minimap.folded .fold-btn { position: static; margin-top: 4px; }
.net { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); flex-shrink: 0; }
.net.err { background: var(--bad); box-shadow: 0 0 6px var(--bad); animation: pulse 1s infinite; }

/* ---------------- เมนู ---------------- */
#menubar { position: fixed; right: calc(var(--gap) + var(--sr)); top: calc(232px + var(--st)); z-index: 30; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
#menubar button { position: relative; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); background: var(--glass);
  color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
#menubar button svg { width: 20px; height: 20px; }
#menubar button span { font-size: 9px; line-height: 1; color: var(--ink-dim); }
#menubar button small { position: absolute; right: 3px; top: 1px; font: 700 8px var(--display); color: var(--ink-faint); }
#menubar button:hover { color: var(--cy); border-color: var(--line-2); background: var(--glass-2); }
#menubar button.on { color: #04121f; background: linear-gradient(var(--cy), var(--cy-2)); border-color: var(--cy); }
#menubar button.on span, #menubar button.on small { color: #04121f; }
#menubar .menu-fold { position: static; width: 44px; height: 30px; font-size: 0; color: var(--cy); }
#menubar .menu-fold::before { content: none; }
#menubar .menu-fold svg { width: 20px; height: 20px; }
#menubar.folded > button:not(.menu-fold) { display: none; }

/* ---------------- แชท ---------------- */
#chat { position: fixed; left: calc(var(--gap) + var(--sl)); bottom: calc(84px + var(--sb)); width: 370px; z-index: 15; padding: 6px 6px 6px 10px;
  background: linear-gradient(90deg, rgba(5,10,20,.8), rgba(5,10,20,.55) 70%, rgba(5,10,20,0)); border-left: 2px solid var(--line-2); }
#chat-log { height: 128px; overflow-y: auto; font-size: 12.5px; padding: 2px 16px 2px 0; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; user-select: none; -webkit-user-select: none;
  -webkit-mask-image: linear-gradient(transparent, #000 16px); mask-image: linear-gradient(transparent, #000 16px); }
.cl { line-height: 1.45; text-shadow: 0 1px 2px #000; color: var(--ink); word-break: break-word; }
.cl.sys { color: #fff27a; } .cl.info { color: #9fdcff; } .cl.err { color: #ff8a96; } .cl.exp { color: #a8b8cc; font-size: 11px; }
.cl.item { color: #b0ffc8; } .cl.lvl { color: var(--exp); font-weight: 700; } .cl.mvp { color: #ff7a8a; font-weight: 700; }
.cl.map { color: #c6b0ff; } .cl.say { color: #fff; }
#chat-input { width: 100%; margin-top: 4px; border: 1px solid var(--line); background: rgba(0,0,0,.45); color: var(--ink); padding: 6px 8px; font: 13px var(--font); outline: none; border-radius: 0; }
#chat-input:focus { border-color: var(--cy); box-shadow: 0 0 0 1px var(--cy-glow); }
#chat-input::placeholder { color: var(--ink-faint); }
#chat .fold-btn { top: 2px; right: 2px; }
#chat.folded #chat-log { height: 38px; cursor: pointer; }
#chat.folded #chat-input { display: none; }

/* ---------------- แถบแอ็กชัน (คอม) ---------------- */
#dock { position: fixed; left: 50%; bottom: calc(var(--gap) + var(--sb)); transform: translateX(-50%); z-index: 25;
  display: flex; align-items: flex-end; gap: 10px; padding: 8px 12px 8px; background: linear-gradient(rgba(6,12,24,0), rgba(6,12,24,.75) 30%);
  border-bottom: 1px solid var(--line-2); }
#dock::before { content: ""; position: absolute; left: 20%; right: 20%; bottom: -1px; height: 1px; background: var(--cy); box-shadow: 0 0 10px var(--cy); }
#hotbar, #potbar { display: flex; gap: 5px; }
#potbar { padding-left: 10px; border-left: 1px solid var(--line); }
.hb { position: relative; width: 50px; height: 50px; cursor: pointer; overflow: hidden; flex-shrink: 0;
  background: radial-gradient(circle at 50% 30%, #17263e, #080e1a); border: 1px solid var(--line-2);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
#potbar .hb { border-radius: 50%; clip-path: none; width: 46px; height: 46px; background: radial-gradient(circle at 50% 30%, #1d2a22, #0a120e); border-color: rgba(120,255,180,.3); }
.hb.blank { background: rgba(8,14,26,.55); border-style: dashed; }
.hb:hover { border-color: var(--cy); }
.hb:active, .hb.press { transform: scale(.93); }
.hb .ic { position: absolute; inset: 5px; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.hb .ic img { width: 36px; height: 36px; }
#potbar .hb .ic img { width: 32px; height: 32px; }
.hb .k { position: absolute; left: 4px; top: 1px; font: 700 9px var(--display); color: var(--cy); pointer-events: none; text-shadow: 0 1px 2px #000; }
#potbar .hb .k { left: 50%; top: auto; bottom: 1px; transform: translateX(-50%); color: #9affc8; }
.hb .q { position: absolute; right: 4px; bottom: 1px; font: 700 10px var(--font); color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000; pointer-events: none; }
#potbar .hb .q { right: 50%; transform: translateX(50%); bottom: auto; top: 2px; }
.hb .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0,10,30,.6); pointer-events: none; }
.hb.nosp .ic, .hb.empty .ic { opacity: .35; filter: grayscale(.6); }
.sicon { width: 34px; height: 34px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 17px; color: #fff;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--c) 42%, color-mix(in srgb, var(--c) 45%, #000) 100%);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); text-shadow: 0 0 3px #000, 0 0 2px #000; }

#auto-btn { width: 56px; height: 56px; border-radius: 50%; padding: 0; flex-shrink: 0; border: 2px solid var(--line-2);
  background: radial-gradient(circle at 40% 30%, #1c2c46, #060b16); color: var(--ink-dim);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 4px 14px rgba(0,0,0,.5); }
#auto-btn svg { width: 16px; height: 16px; }
#auto-btn b { font: 700 11px var(--display); letter-spacing: .03em; color: #fff; margin-top: 1px; }
#auto-btn small { font-size: 9px; }
#auto-btn.on { border-color: var(--ok); color: #eafff2; background: radial-gradient(circle at 40% 30%, #3ee08a, #0c5a34); animation: autoGlow 1.4s infinite; }
@keyframes autoGlow { 50% { box-shadow: 0 0 0 6px rgba(90,240,160,.25), 0 4px 14px rgba(0,0,0,.5); } }

#hud-toggle { position: fixed; left: calc(330px + var(--sl)); top: calc(var(--gap) + var(--st)); width: 26px; height: 26px; padding: 0; z-index: 30;
  background: var(--glass); border: 1px solid var(--line); color: var(--cy); font-size: 12px; border-radius: 50%; }
#hud-toggle::before { content: "◉"; }
#hud.hud-min #basic-info, #hud.hud-min #minimap, #hud.hud-min #chat, #hud.hud-min #menubar, #hud.hud-min #buffs { display: none; }
#hud.hud-min #hud-toggle { background: var(--cy); color: #04121f; left: calc(var(--gap) + var(--sl)); }

/* ---------------- ปุ่มควบคุมบนจอ (ซ่อนเมื่อไม่ใช่โหมด PAD) ---------------- */
#pad { display: none; }
.pad-mode #pad { display: block; }
#joy-zone { position: fixed; left: 0; bottom: 0; width: min(46vw, 280px); height: min(44vh, 260px); z-index: 18; touch-action: none; }
#joy { position: absolute; left: calc(92px + var(--sl)); top: calc(100% - 92px - var(--sb)); width: 118px; height: 118px; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(98,227,255,.06) 0 55%, rgba(98,227,255,.14) 56% 58%, rgba(6,12,24,.35) 59%);
  border: 1px solid var(--line-2); opacity: .55; transition: opacity .15s; pointer-events: none; }
#joy.on { opacity: 1; box-shadow: 0 0 20px rgba(98,227,255,.25); }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #bff4ff, var(--cy) 35%, var(--cy-2) 75%); box-shadow: 0 0 14px var(--cy-glow), 0 3px 8px rgba(0,0,0,.5); }
#pad-atk { position: fixed; right: calc(28px + var(--sr)); bottom: calc(28px + var(--sb)); width: 84px; height: 84px; border-radius: 50%; z-index: 26; padding: 0;
  border: 2px solid rgba(255,150,120,.7); color: #fff; background: radial-gradient(circle at 40% 30%, #ff9a7a, #d8324a 55%, #5a0c1c);
  box-shadow: 0 0 0 5px rgba(255,90,90,.15), 0 6px 18px rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
#pad-atk svg { width: 38px; height: 38px; stroke-width: 2.2; }
#pad-atk.press { transform: scale(.92); box-shadow: 0 0 0 9px rgba(255,90,90,.25), 0 4px 12px rgba(0,0,0,.55); }

/* โหมด PAD: สกิลเรียงเป็นวงโค้งรอบปุ่มโจมตี */
.pad-mode #dock { position: static; transform: none; background: none; border: 0; padding: 0; }
.pad-mode #dock::before { content: none; }
.pad-mode #hotbar .hb { position: fixed; z-index: 26; width: 54px; height: 54px; border-radius: 50%; clip-path: none; border: 1.5px solid var(--line-2);
  box-shadow: 0 3px 10px rgba(0,0,0,.5); }
.pad-mode #hotbar .hb.blank { opacity: .4; }
.pad-mode #hotbar .hb.blank:nth-child(n+5) { display: none; }
.pad-mode #hotbar .hb .k { display: none; }
.pad-mode #hotbar .hb .q { right: 50%; transform: translateX(50%); bottom: 2px; font-size: 9px; }
.pad-mode #hotbar .hb:nth-child(1) { right: calc(135px + var(--sr)); bottom: calc(43px + var(--sb)); }
.pad-mode #hotbar .hb:nth-child(2) { right: calc(123px + var(--sr)); bottom: calc(89px + var(--sb)); }
.pad-mode #hotbar .hb:nth-child(3) { right: calc(89px + var(--sr)); bottom: calc(123px + var(--sb)); }
.pad-mode #hotbar .hb:nth-child(4) { right: calc(43px + var(--sr)); bottom: calc(135px + var(--sb)); }
.pad-mode #hotbar .hb:nth-child(n+5) { width: 46px; height: 46px; }
.pad-mode #hotbar .hb:nth-child(n+5) .ic { inset: 4px; }
.pad-mode #hotbar .hb:nth-child(n+5) .ic .sicon { width: 28px; height: 28px; font-size: 14px; }
.pad-mode #hotbar .hb:nth-child(5) { right: calc(202px + var(--sr)); bottom: calc(69px + var(--sb)); }
.pad-mode #hotbar .hb:nth-child(6) { right: calc(176px + var(--sr)); bottom: calc(134px + var(--sb)); }
.pad-mode #hotbar .hb:nth-child(7) { right: calc(130px + var(--sr)); bottom: calc(179px + var(--sb)); }
.pad-mode #hotbar .hb:nth-child(8) { right: calc(69px + var(--sr)); bottom: calc(202px + var(--sb)); }
.pad-mode #potbar { position: fixed; left: calc(14px + var(--sl)); bottom: calc(200px + var(--sb)); flex-direction: column-reverse; gap: 8px; padding: 0; border: 0; z-index: 26; }
.pad-mode #potbar .hb { box-shadow: 0 3px 10px rgba(0,0,0,.5); }
.pad-mode #auto-btn { position: fixed; right: calc(14px + var(--sr)); bottom: calc(262px + var(--sb)); width: 54px; height: 54px; z-index: 26; }
.pad-mode #chat { bottom: calc(420px + var(--sb)); width: min(72vw, 360px); }
.pad-mode #chat-input { font-size: 16px; }
/* โหมด PAD: แชทเป็นตัวหนังสือลอยบนเกม ไม่มีกรอบ แตะปุ่ม 💬 เพื่อพิมพ์ */
#chat-btn { display: none; }
.pad-mode #chat { background: none; border: 0; padding: 0; pointer-events: none; }
/* มือถือ: แถบเควสต์ย้ายไปขวาใต้มินิแมพ (ซ้ายมีปุ่มยา/แชต) */
.pad-mode #quest-track { left: auto; right: calc(var(--gap) + var(--sr)); top: calc(206px + var(--st)); width: min(52vw, 210px); text-align: right;
  border-left: 0; border-right: 2px solid #ffd34a; background: linear-gradient(260deg, rgba(10,20,38,.85), rgba(7,13,24,.35)); }
.pad-mode .qt-title { justify-content: flex-end; }
.pad-mode .qt-obj { flex-direction: row-reverse; }
@media (orientation: portrait) { .pad-mode #quest-track { top: calc(146px + var(--st)); right: calc(var(--gap) + var(--sr) + 50px); width: min(46vw, 190px); } }
.pad-mode #chat .fold-btn { display: none; }
.pad-mode #chat-log { height: auto; max-height: 96px; overflow: hidden; padding: 0; font-size: 12px; -webkit-mask-image: linear-gradient(transparent, #000 30%); mask-image: linear-gradient(transparent, #000 30%); }
.pad-mode #chat-log .cl { text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 6px rgba(0,0,0,.8); line-height: 1.35; }
.pad-mode #chat-input { display: none; position: fixed; left: 8px; right: 8px; bottom: calc(8px + var(--sb)); width: auto; z-index: 90; padding: 10px 12px; background: rgba(6,12,24,.96); border: 1px solid var(--cy); pointer-events: auto; }
.pad-mode #chat.typing #chat-input { display: block; }
.pad-mode #chat-btn { display: flex; align-items: center; justify-content: center; position: fixed; z-index: 26; width: 38px; height: 38px; border-radius: 50%; padding: 0;
  border: 1px solid var(--line-2); background: rgba(8,16,30,.9); color: var(--cy); }
.pad-mode #chat-btn svg { width: 20px; height: 20px; }
/* เมนูบนจอสัมผัส: ปุ่ม ☰ + กริดป๊อปอัพ */
.pad-mode #menubar { flex-direction: row-reverse; flex-wrap: wrap; justify-content: flex-start; align-items: flex-start; width: 44px; }
.pad-mode #menubar:not(.folded) { width: calc(44px * 5 + 5px * 4); background: none; }
.pad-mode #menubar .menu-fold { height: 44px; order: -1; }
.pad-mode #menubar button { width: 44px; height: 48px; }

/* ---------------- หน้าต่าง ---------------- */
.win { position: fixed; z-index: 100; display: flex; flex-direction: column; max-height: calc(100dvh - 20px); font-size: 13px; color: var(--ink);
  background: linear-gradient(rgba(12,20,36,.96), rgba(7,12,22,.96)); border: 1px solid var(--line-2);
  box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 0 24px rgba(40,150,230,.14), 0 14px 34px rgba(0,0,0,.6);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px)); }
.win.center { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.win-title { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 7px 12px; cursor: move; touch-action: none;
  background: linear-gradient(90deg, rgba(98,227,255,.16), rgba(98,227,255,0) 70%); border-bottom: 1px solid var(--line); }
.win-title span { font: 600 14px var(--display); letter-spacing: .01em; color: #fff; }
.win-title span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; background: var(--cy); transform: rotate(45deg) translateY(-1px); box-shadow: 0 0 6px var(--cy); }
.win-x { width: 26px; height: 26px; padding: 0; margin-right: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.3); color: var(--ink-dim); font-size: 17px; line-height: 22px; }
.win-x:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.win-body { padding: 10px 12px 12px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.btn { background: linear-gradient(#18304c, #0e1c30); border: 1px solid var(--line-2); padding: 5px 12px; font-size: 12.5px; font-weight: 600; color: var(--gold-hi);
  clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.btn:hover { background: linear-gradient(#20406a, #12253e); border-color: var(--cy); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.small { padding: 3px 9px; font-size: 11.5px; }
.btn.danger { color: #ffa0a8; }
.btn.big { padding: 11px 30px; font-size: 15px; color: #04121f; background: linear-gradient(var(--cy), var(--cy-2)); border-color: #bff4ff; }

/* status */
.st-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.st-row { display: grid; grid-template-columns: 38px 1fr 28px 24px; align-items: center; gap: 4px; padding: 3px 0; border-bottom: 1px solid rgba(110,200,255,.1); }
.st-n, .st-row2 span { font: 600 13px var(--display); color: var(--cy); }
.st-v { font-weight: 700; }
.st-v em { color: var(--ok); font-style: normal; font-size: 11px; }
.st-up { border: 1px solid var(--line-2); background: #10213a; color: var(--cy); font-size: 10px; padding: 2px 0; }
.st-up:disabled { opacity: .3; cursor: default; }
.st-c { color: var(--ink-faint); font-size: 10px; text-align: right; }
.st-row2 { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid rgba(110,200,255,.1); }
.st-foot { margin-top: 10px; font-size: 12px; }
.st-foot b, .sk-head b { color: #ff8a96; font-size: 14px; }

/* inventory */
.tabs { display: flex; gap: 3px; margin-bottom: 8px; }
.tab { flex: 1; background: rgba(0,0,0,.3); border: 1px solid var(--line); border-bottom-color: var(--line-2); padding: 5px; font-size: 12px; font-weight: 600; color: var(--ink-dim); }
.tab.on { background: rgba(98,227,255,.14); color: #fff; border-color: var(--cy); box-shadow: inset 0 -2px 0 var(--cy); }
.inv-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; max-height: 200px; overflow-y: auto; padding: 2px; }
.inv-cell { aspect-ratio: 1; border: 1px solid var(--line); background: radial-gradient(circle at 50% 35%, #15233a, #0a111e); position: relative; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.inv-cell img { width: 80%; height: 80%; pointer-events: none; }
.inv-cell.sel { border-color: var(--cy); box-shadow: 0 0 0 1px var(--cy) inset, 0 0 10px var(--cy-glow); }
.inv-cell.empty { background: rgba(0,0,0,.25); cursor: default; }
.inv-cell .q { position: absolute; right: 2px; bottom: 0; font-size: 10px; font-weight: 700; color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000; }
.inv-cell .rf { position: absolute; left: 2px; top: 0; font-size: 9px; font-weight: 700; color: var(--exp); text-shadow: 0 0 2px #000; }
.inv-detail, .sk-row, .eq-slot, .shop-row, .dlg-text, .bot-stats > div { background: rgba(14,26,46,.7); border: 1px solid var(--line); color: var(--ink); }
.inv-detail { margin-top: 8px; padding: 8px; min-height: 60px; }
.det-head { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.det-head img { width: 28px; height: 28px; }
.det-desc { margin: 4px 0; color: #c8d6e8; }
.det-line { color: var(--ink-dim); font-size: 11px; }
.det-acts { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.inv-foot { margin-top: 6px; text-align: right; color: var(--exp); }

/* equip */
/* ---------- หน้าต่างอุปกรณ์ (แบบ RO): หนังเก่า/ทองหม่น/หิน + รูนนอร์สในช่องว่าง — ธีมเฉพาะหน้าต่างนี้ทั้งสองโหมด HUD ---------- */
/* earth tone โทนสว่าง (เจ้าของขอ): หนังสีน้ำตาลอ่อน/ทราย แทนน้ำตาลเข้มเกือบดำ */
#w-equip { --eq-bg: #5a4430; --eq-bg2: #7d6244; --eq-slot: rgba(42, 28, 15, .42); --eq-line: rgba(232, 196, 136, .42); --eq-line-hi: #ecc98a;
  --eq-gold: #f3d59c; --eq-ink: #fff5e2; --eq-dim: #dcc29a; --eq-faint: rgba(236, 205, 150, .4); }
body #w-equip.win { background: linear-gradient(170deg, var(--eq-bg2), var(--eq-bg) 60%, #46331f); border: 1px solid var(--eq-line); color: var(--eq-ink);
  box-shadow: 0 26px 50px -22px rgba(0, 0, 0, .9), inset 0 0 0 1px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 226, 170, .1); -webkit-backdrop-filter: none; backdrop-filter: none; }
body #w-equip.win::before { background: radial-gradient(110% 45% at 50% -12%, rgba(217, 178, 118, .16), rgba(217, 178, 118, 0) 62%); }
body #w-equip .win-title { border-bottom: 1px solid var(--eq-line); background: linear-gradient(180deg, rgba(255, 236, 200, .14), rgba(0, 0, 0, .08)); }
body #w-equip .win-title span { color: var(--eq-gold); letter-spacing: .03em; }
body #w-equip .win-title span::before { background: var(--eq-gold); box-shadow: 0 0 8px rgba(217, 178, 118, .6); border-radius: 0; transform: rotate(45deg); }
body #w-equip .win-x { background: rgba(0, 0, 0, .3); color: var(--eq-dim); }
.eq-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 132px minmax(0, 1fr); gap: 8px; align-items: stretch; }
.eq-col { display: flex; flex-direction: column; justify-content: space-around; gap: 5px; min-width: 0; } /* 4 ช่องเรียงเต็มความสูงตัวละคร ซ้าย-ขวาตรงกัน */
body #w-equip .eq-slot { display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: center; gap: 6px; padding: 3px 6px; min-height: 34px; cursor: pointer;
  background: var(--eq-slot); border: 1px solid var(--eq-line); border-radius: 4px; color: var(--eq-ink); box-shadow: inset 0 1px 0 rgba(255, 226, 170, .05); }
body #w-equip .eq-slot.empty { cursor: default; background: rgba(42, 28, 15, .22); border-style: dashed; border-color: var(--eq-faint); }
body #w-equip .eq-slot:not(.empty):hover { border-color: var(--eq-line-hi); background: rgba(201, 154, 91, .12); }
.eq-slot img, .eq-ph { width: 26px; height: 26px; image-rendering: auto; }
.eq-slot img { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .7)); }
/* ช่องว่าง: รูนประจำช่อง (หมวก ᚺ • อาวุธ ᛏ • ผ้าคลุม ᚹ • เครื่องประดับ ᛟ • เกราะ ᛒ • โล่ ᛉ • รองเท้า ᚱ) */
.eq-ph { display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--eq-faint); color: var(--eq-faint); font: 600 16px/1 "Segoe UI Historic", "Noto Sans Runic", serif; }
.eq-ph-head::after { content: "ᚺ"; } .eq-ph-weapon::after { content: "ᛏ"; } .eq-ph-garment::after { content: "ᚹ"; } .eq-ph-acc::after { content: "ᛟ"; }
.eq-ph-acc2::after { content: "ᛟ"; } .eq-ph-armor::after { content: "ᛒ"; } .eq-ph-shield::after { content: "ᛉ"; } .eq-ph-shoes::after { content: "ᚱ"; }
.eq-i { font-size: 11.5px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* ชื่อบรรทัดเดียว (ยาวเกินตัด …) — ชี้/แตะดูชื่อเต็มใน tooltip */
.eq-slot.empty .eq-i { color: var(--eq-dim); opacity: .6; font-weight: 500; }
.eq-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; }
body #w-equip .eq-prev { width: 132px; height: 173px; border: 1px solid var(--eq-line); border-radius: 6px;
  background: radial-gradient(60% 18% at 50% 87%, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0) 100%), radial-gradient(90% 70% at 50% 60%, #8f7350, #4a3522 78%); }
.eq-stage { position: relative; }
.eq-stage .eq-prev { display: block; }
.eq-turn { position: absolute; bottom: 5px; width: 26px; height: 24px; padding: 0; border: 1px solid var(--eq-line); border-radius: 4px; background: rgba(20, 14, 9, .7); color: var(--eq-gold); font-size: 15px; line-height: 1; cursor: pointer; }
.eq-turn:first-of-type { left: 5px; } .eq-turn:last-of-type { right: 5px; }
.eq-turn:hover { border-color: var(--eq-line-hi); background: rgba(201, 154, 91, .15); }
.eq-job { width: 100%; text-align: center; font: 600 11px var(--display); color: var(--eq-gold); letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body #w-equip .hint { color: var(--eq-dim); }

/* skills */
.sk-head { margin-bottom: 8px; }
.sk-list { display: flex; flex-direction: column; gap: 5px; }
.sk-row { display: flex; gap: 9px; align-items: center; padding: 6px; }
.sk-row.locked .sicon { filter: grayscale(.85); opacity: .55; }
.sk-info { flex: 1; min-width: 0; }
.sk-name { font-weight: 700; color: #fff; }
.sk-lv { color: var(--cy); }
.tag { background: rgba(98,227,255,.12); color: var(--ink-dim); font-size: 9.5px; padding: 0 6px; margin-left: 4px; font-weight: 500; }
.sk-desc { font-size: 11.5px; color: #c0cfe2; }
.sk-req { font-size: 10.5px; color: #ff9aa4; }
.sk-req.ok { color: var(--ok); }
.sk-acts { display: flex; flex-direction: column; gap: 3px; }

/* dialog */
.win.dialog { left: 50%; bottom: 150px; width: 460px; transform: translateX(-50%); }
.dlg-text { font-size: 14px; line-height: 1.65; min-height: 54px; padding: 9px 11px; }
.npc-hl { color: var(--cy); }
.dlg-btns { text-align: right; margin-top: 8px; }
.dlg-menu { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.dlg-opt { text-align: left; background: rgba(0,0,0,.3); border: 1px solid var(--line); padding: 7px 10px; font-size: 13px; color: var(--ink); }
.dlg-opt:hover, .dlg-opt.gp-sel, .btn.gp-sel { background: rgba(98,227,255,.14); border-color: var(--cy); color: #fff; }
.dlg-opt::before { content: "▸ "; color: var(--cy); }

/* shop */
.shop-list { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.shop-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; }
.shop-row.dim { opacity: .55; }
.shop-row.sellall { justify-content: center; background: rgba(255,208,90,.08); }
.shop-row img { width: 26px; height: 26px; flex-shrink: 0; }
.shop-n { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shop-n small { color: var(--ink-dim); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-p { color: var(--exp); font-weight: 700; white-space: nowrap; }
.qty { width: 50px; font: 12px var(--font); padding: 3px; background: rgba(0,0,0,.4); border: 1px solid var(--line-2); color: var(--ink); }

/* options / confirm / help */
.opt { display: block; padding: 5px 0; cursor: pointer; }
.opt-lbl { margin: 10px 0 5px; font-size: 12px; color: var(--cy); font-weight: 600; }
.opt-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cf-text { font-size: 13.5px; line-height: 1.55; margin-bottom: 10px; }
.cf-btns { display: flex; justify-content: flex-end; gap: 6px; }
.help h4 { margin: 6px 0 4px; font: 600 14px var(--display); letter-spacing: .01em; color: var(--cy); }
.help ul, .help ol { margin: 0 0 8px; padding-left: 20px; line-height: 1.65; }
input[type=range], input[type=checkbox] { accent-color: var(--cy); }

/* bot */
.bot-toggle { width: 100%; margin-bottom: 8px; }
.bot-toggle.on { background: linear-gradient(#7a1c2a, #4a0e18) !important; color: #ffe6ea !important; border-color: var(--bad) !important; }
.bot-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 6px; }
.bot-stats > div { padding: 4px 6px; font-size: 10px; color: var(--ink-dim); display: flex; flex-direction: column; }
.bot-stats b { color: #fff; font-size: 12.5px; }
.bot-sec { font: 600 13px var(--display); letter-spacing: .01em; color: var(--cy); margin: 10px 0 4px; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.bot-row { display: grid; grid-template-columns: 1fr 90px 44px; align-items: center; gap: 6px; padding: 2px 0; font-size: 11.5px; }
.bot-row b { text-align: right; color: #fff; }
.bot-row input { width: 100%; }
.bot-skill { display: flex; align-items: center; gap: 6px; }
.bot-skill .sicon { width: 24px; height: 24px; font-size: 12px; }

/* ---------------- ประกาศ / แบนเนอร์ / ตาย ---------------- */
#announce { position: fixed; left: 50%; top: calc(78px + var(--st)); transform: translateX(-50%); z-index: 40; color: var(--exp); font-weight: 700; font-size: 17px;
  text-shadow: 0 0 4px #000, 0 2px 3px #000; opacity: 0; pointer-events: none; text-align: center; max-width: min(90vw, 560px); }
#announce.show { animation: ann 5s ease forwards; }
@keyframes ann { 0% { opacity: 0; transform: translate(-50%, -10px); } 8% { opacity: 1; transform: translate(-50%, 0); } 85% { opacity: 1; } 100% { opacity: 0; } }
#map-banner { position: fixed; left: 50%; top: 24%; transform: translateX(-50%); text-align: center; opacity: 0; pointer-events: none; z-index: 40; width: max-content; max-width: 92vw; }
#map-banner.show { animation: banner 3.2s ease forwards; }
.mb-en { font: 700 clamp(24px, 5.4vw, 40px) var(--display); color: #fff; letter-spacing: .04em; text-shadow: 0 0 18px var(--cy-glow), 0 2px 4px #000; }
.mb-th { font-size: 15px; color: var(--cy); text-shadow: 0 0 6px #000, 0 1px 2px #000; margin-top: 2px; }
.mb-en::after { content: ""; display: block; height: 1px; margin: 6px auto 0; width: 70%; background: linear-gradient(90deg, transparent, var(--cy), transparent); }
@keyframes banner { 0% { opacity: 0; letter-spacing: .12em; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
#death { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 5000; background: radial-gradient(circle, rgba(60,0,10,.3), rgba(0,0,0,.6)); }
.death-box { background: rgba(14,6,10,.92); border: 1px solid rgba(255,90,106,.6); padding: 26px 36px; text-align: center; color: #fff; max-width: calc(100vw - 32px);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px)); }
.death-t { font: 700 30px var(--display); letter-spacing: .04em; color: var(--bad); text-shadow: 0 0 14px rgba(255,60,80,.6); }
.death-s { margin: 8px 0 18px; color: #e8c8cc; }
.death-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
#death-hide { margin-top: 14px; color: #e8c8cc; }
#death-mini { position: fixed; left: 50%; bottom: calc(96px + var(--sb, 0px)); transform: translateX(-50%); z-index: 4999; font: 600 15px var(--font); color: #fff; padding: 10px 20px;
  background: rgba(40,6,14,.9); border: 1px solid rgba(255,90,106,.7); box-shadow: 0 0 18px rgba(255,60,80,.35); cursor: pointer; animation: pulseDead 1.6s ease-in-out infinite; }
@keyframes pulseDead { 50% { box-shadow: 0 0 28px rgba(255,60,80,.6); } }

/* ---------------- ภาพประกอบ / ฉากบอส ---------------- */
#illust { position: fixed; left: max(4vw, 20px); bottom: 0; height: min(78vh, 720px); z-index: 90; pointer-events: none; opacity: 0; transform: translateX(-30px); transition: opacity .35s, transform .35s; }
#illust.show { opacity: 1; transform: none; }
#illust img { height: 100%; width: auto; max-width: 46vw; object-fit: contain; object-position: bottom left; filter: drop-shadow(0 0 18px rgba(0,0,0,.6)); }
#splash { position: fixed; inset: 0; z-index: 4000; pointer-events: none; display: flex; align-items: center; justify-content: center; opacity: 0; }
#splash.show { animation: splashIn 3.2s ease forwards; }
#splash img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 25%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); }
#splash .sp-text { position: relative; margin-top: 32vh; text-align: center; padding: 10px 40px; background: linear-gradient(90deg, transparent, rgba(120,0,10,.75), transparent); }
#splash.noimg .sp-text { margin-top: 0; }
#splash.upgrade .sp-text { background: linear-gradient(90deg, transparent, rgba(10,80,130,.8), transparent); }
#splash.upgrade .sp-text small { color: #aef0ff; }
#splash.upgrade .sp-text b { text-shadow: 0 0 16px var(--cy); }
#splash .sp-text small { display: block; color: #ffb0b0; font: 500 13px/1.4 var(--display); letter-spacing: .12em; }
#splash .sp-text b { display: block; color: #fff; font: 700 clamp(28px, 5.4vw, 52px)/1.15 var(--display); letter-spacing: .02em; text-shadow: 0 0 16px #ff3040; }
@keyframes splashIn { 0% { opacity: 0; transform: scale(1.08); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------------- หน้าไตเติล ---------------- */
#title { position: fixed; inset: 0; z-index: 9000; overflow: hidden; background: #04060f; transition: opacity .6s ease; }
#title.leaving { opacity: 0; pointer-events: none; }
#title-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-stage { position: absolute; right: max(3vw, 16px); bottom: 0; width: min(46vw, 620px); height: min(90vh, 900px); pointer-events: none; transition: opacity .4s; }
.hero { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; height: 100%; width: auto; max-width: 100%; object-fit: contain; object-position: bottom center;
  opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .9s ease, transform .9s ease; filter: drop-shadow(0 0 28px rgba(60,180,255,.35)) drop-shadow(0 10px 20px rgba(0,0,0,.6)); }
.hero.show { opacity: 1; transform: none; }
.hero-ring { position: absolute; left: 50%; bottom: -8px; width: 78%; height: 12%; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(98,227,255,.45), rgba(98,227,255,.12) 45%, transparent 70%); animation: ringPulse 3s ease-in-out infinite; }
.hero-ring::after { content: ""; position: absolute; inset: 22% 6%; border-radius: 50%; border: 1px solid rgba(98,227,255,.5); box-shadow: 0 0 12px rgba(98,227,255,.5); }
@keyframes ringPulse { 50% { opacity: .6; } }
#title:not(.has-hero) .hero-stage, #title.creating .hero-stage, #title.selecting .hero-stage, #title.has-keyart .hero-stage { opacity: 0; }
#title.has-keyart .hero-cap { display: none; }
.hero-cap { display: inline-block; margin-top: 10px; font-size: 12.5px; color: #8fd8ff; letter-spacing: .04em; opacity: 0; transition: opacity .6s; }
#title.has-hero:not(.creating):not(.selecting) .hero-cap { opacity: .9; }

.title-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 22px;
  padding: calc(24px + var(--st)) 16px calc(24px + var(--sb)) max(6vw, 24px); width: min(560px, 100%); }
.title-top { text-align: left; animation: fadeUp .8s ease-out both; }
.logo { font: 800 clamp(38px, 8vw, 84px) var(--display); letter-spacing: .04em; line-height: 1.05;
  background: linear-gradient(#ffffff 10%, #9fe6ff 45%, #3a8fd8 90%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 12px rgba(90,200,255,.55)) drop-shadow(0 4px 0 #0a1a34); }
.logo.logo-img { background: none; filter: drop-shadow(0 0 16px rgba(90,200,255,.45)) drop-shadow(0 8px 18px rgba(0,0,0,.6)); animation: logoGlow 4s ease-in-out infinite; }
@keyframes logoGlow { 50% { filter: drop-shadow(0 0 30px rgba(120,220,255,.75)) drop-shadow(0 8px 18px rgba(0,0,0,.6)); } }
.logo.logo-img img { width: min(520px, 100%); height: auto; display: block; }
.logo-sub { color: #bfe8ff; font-size: 15px; margin-top: 6px; text-shadow: 0 2px 4px rgba(0,0,0,.6); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } }

.title-menu { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; animation: fadeUp .8s .25s ease-out both; }
.tbtn { position: relative; min-width: 280px; padding: 12px 26px; font-size: 18px; font-weight: 700; display: flex; flex-direction: column; align-items: center; line-height: 1.15;
  background: linear-gradient(#1c2a44, #0e1628); border: 1px solid #4a8ad0; color: #d8f2ff; box-shadow: 0 0 16px rgba(90,170,255,.2), inset 0 1px 0 rgba(255,255,255,.12);
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%); transition: filter .15s, transform .15s; }
.tbtn small { font-size: 12px; font-weight: 400; color: #8fb8dc; }
.tbtn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.tbtn:active { transform: translateY(1px); }
.tbtn.small { min-width: 0; font-size: 14px; padding: 8px 18px; }
.tbtn.primary { background: linear-gradient(#7ae8ff, #2a86c8); color: #04121f; border-color: #bff4ff; box-shadow: 0 0 22px rgba(98,227,255,.4), inset 0 1px 0 rgba(255,255,255,.5); }
.tbtn.primary small { color: #0a3a5a; }
.tbtn.primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-100%); animation: sheen 3.5s ease-in-out infinite; }
@keyframes sheen { 30%, 100% { transform: translateX(100%); } }
.title-foot { margin-top: 10px; color: rgba(190,225,255,.65); font-size: 12px; text-shadow: 0 1px 2px rgba(0,0,0,.6); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { font: 700 10px var(--display); letter-spacing: .12em; color: #04121f; background: var(--cy); padding: 2px 7px; }

.card { text-align: left; padding: 16px; color: var(--ink); background: linear-gradient(rgba(12,20,36,.94), rgba(7,12,22,.94)); border: 1px solid var(--line-2);
  box-shadow: 0 0 30px rgba(40,150,230,.15), 0 12px 30px rgba(0,0,0,.5); clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  animation: fadeUp .5s ease-out both; }
.create { display: flex; gap: 18px; width: min(680px, 100%); max-height: calc(100dvh - 40px - var(--st) - var(--sb)); overflow-y: auto; }
#title.creating .title-inner, #title.selecting .title-inner { width: min(720px, 100%); left: 50%; transform: translateX(-50%); align-items: center; padding-left: 16px; }
#title.creating .title-top, #title.selecting .title-top { text-align: center; }
#title.creating .logo.logo-img img, #title.selecting .logo.logo-img img { width: min(300px, 70vw); margin: 0 auto; }
#title.creating .logo-sub, #title.selecting .logo-sub { display: none; }
.cr-left { display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; }
.cr-left canvas { display: block; width: 220px; height: 260px; border: 1px solid var(--line); background: radial-gradient(circle at 50% 82%, #1c3a5c, #0a1222 65%, #060a14); }
.cr-rot { display: flex; gap: 5px; }
.cr-rot button { border: 1px solid var(--line-2); background: rgba(0,0,0,.35); color: var(--ink); padding: 5px 10px; font-size: 13px; min-width: 38px; }
.cr-rot button.on { color: #04121f; background: var(--cy); border-color: var(--cy); }
.cr-right { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cr-right label, .auth label { font-weight: 600; color: var(--cy); margin-top: 5px; font-size: 12.5px; letter-spacing: .02em; }
#cr-name, .auth input { font: 16px var(--font); padding: 8px 10px; background: rgba(0,0,0,.45); border: 1px solid var(--line-2); color: var(--ink); outline: none; width: 100%; border-radius: 0; }
#cr-name:focus, .auth input:focus { border-color: var(--cy); box-shadow: 0 0 0 2px rgba(98,227,255,.2); }
.seg { display: flex; gap: 4px; }
.seg-wrap { flex-wrap: wrap; }
.seg-wrap button { flex: 1 0 calc(33.3% - 4px); }
.seg button { flex: 1; border: 1px solid var(--line-2); background: rgba(0,0,0,.35); padding: 6px 4px; font-weight: 600; font-size: 12.5px; color: var(--ink-dim); }
.seg button.on { background: linear-gradient(var(--cy), var(--cy-2)); color: #04121f; border-color: #bff4ff; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #0a1120; box-shadow: 0 0 0 1px var(--line-2); padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--cy), 0 0 10px var(--cy-glow); }
.err { color: #ff9aa4; min-height: 17px; font-size: 12px; }
.cr-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: auto; padding-top: 6px; position: sticky; bottom: -16px; padding-bottom: 6px; background: linear-gradient(transparent, rgba(7,12,22,.96) 40%); }
.auth { display: flex; flex-direction: column; gap: 6px; width: min(380px, 100%); }
.auth .tbtn { width: 100%; min-width: 0; margin-top: 4px; }
.auth .tbtn:disabled { opacity: .6; cursor: wait; }
.au-note { font-size: 11.5px; color: var(--ink-dim); text-align: center; opacity: .8; }
.auth .linkbtn { align-self: center; }
.linkbtn { background: none; border: 0; color: var(--cy); text-decoration: underline; font-size: 13px; padding: 4px; }
.acct { margin: 18px 0 0; align-self: flex-start; color: var(--ink); font-size: 13.5px; padding: 6px 14px; background: rgba(4,9,18,.78); border: 1px solid var(--line-2); backdrop-filter: blur(6px); }
.acct b { color: var(--cy); }

/* =====================================================================
   ขนาดจอ
   ===================================================================== */
/* จอสัมผัส: ปุ่มใหญ่ขึ้น */
@media (pointer: coarse) {
  .win-x, body.visor .win-x { width: 28px; height: 28px; font-size: 18px; line-height: 26px; } /* จอสัมผัส: ปุ่มปิดใหญ่พอแตะ แต่ไม่ทำให้หัวหน้าต่างหนา */
  .btn.small { padding: 6px 11px; font-size: 12.5px; }
  .st-up { padding: 6px 0; font-size: 12px; }
  .dlg-opt { padding: 11px 12px; font-size: 14px; }
  .opt input, .bot-row input[type=range] { transform: scale(1.25); }
  #chat-input, .qty { font-size: 16px; }
  #menubar button small { display: none; }
}

/* แท็บเล็ต / จอกลาง */
@media (max-width: 1100px) {
  #dock .hb { width: 46px; height: 46px; }
  #chat { width: 320px; }
  #chat-log { height: 96px; }
}

/* มือถือแนวตั้ง */
@media (max-width: 760px) {
  :root { --gap: 8px; }
  #basic-info { width: min(64vw, 250px); padding: 7px 9px 7px 7px; gap: 7px; }
  .bi-face, .bi-face canvas { width: 44px; height: 50px; }
  .bi-id b { font-size: 12px; }
  .bi-id span { font-size: 9.5px; }
  .gauge { height: 13px; } .gauge i, .gauge span { line-height: 13px; font-size: 9.5px; }
  .xrow label { width: 42px; font-size: 8px; } .xrow > span { width: 34px; font-size: 9px; }
  .bi-foot { font-size: 11px; }
  #buffs { top: calc(174px + var(--st)); max-width: 64vw; }
  #quest-track { top: calc(206px + var(--st)); width: min(64vw, 230px); font-size: 12px; }
  #hud-toggle { left: 50%; top: var(--st); transform: translateX(-50%); width: 34px; height: 18px; border-radius: 0 0 8px 8px; font-size: 10px; line-height: 16px; }
  #hud.hud-min #hud-toggle { left: 50%; }
  #minimap { width: 104px; }
  .mm-ring { width: 100px; height: 100px; padding: 3px; }
  .mm-head { max-width: 110px; padding: 1px 9px; }
  #map-name { font-size: 9px; line-height: 14px; }
  .mm-sub { display: none; }
  .mm-btn { width: 28px; height: 28px; }
  #map-open { left: -12px; top: 74px; }
  #zoom-ctl button:nth-child(1) { left: -16px; top: 4px; }
  #zoom-ctl button:nth-child(2) { left: -22px; top: 38px; }
  #menubar { top: calc(152px + var(--st)); }
  #chat { width: calc(100vw - 16px - var(--sl) - var(--sr)); }
  #chat-log { height: 76px; font-size: 12px; }
  #announce { top: calc(270px + var(--st)); font-size: 14px; max-width: calc(100vw - 32px); }
  #target { top: calc(122px + var(--st)); width: min(250px, 64vw); padding: 4px 10px 4px 4px; }
  #nav-pill { top: calc(176px + var(--st)); left: calc(8px + var(--sl)); transform: none; font-size: 12px; }
  #tg-cv { width: 34px; height: 34px; }
  .pad-mode #chat { top: calc(206px + var(--st)); bottom: auto; width: min(70vw, 320px); }
  .pad-mode #chat-btn { left: calc(14px + var(--sl)); bottom: calc(150px + var(--sb)); }
  /* ไม่ใช่โหมด PAD บนจอเล็ก: แถบสกิล 2 แถว */
  body:not(.pad-mode) #dock { flex-wrap: wrap; justify-content: center; width: calc(100vw - 16px); padding: 6px; gap: 6px; }
  body:not(.pad-mode) #dock .hb { width: 40px; height: 40px; }
  body:not(.pad-mode) #chat { bottom: calc(118px + var(--sb)); }
  .win { width: calc(100vw - 16px - var(--sl) - var(--sr)) !important; left: calc(8px + var(--sl)) !important; right: auto !important; top: calc(8px + var(--st)) !important;
    transform: none !important; max-height: calc(100dvh - 16px - var(--st) - var(--sb)); }
  .win.dialog { top: auto !important; bottom: calc(8px + var(--sb)); }
  .create { flex-direction: column; align-items: stretch; padding: 12px; gap: 10px; }
  .cr-left canvas { width: 150px; height: 176px; }
  .cr-right label { margin-top: 2px; }
  /* มือถือ: โลโก้บน ตัวละครเต็มตัวกลางจอ ปุ่มอยู่บนแผ่นมืดด้านล่าง */
  .title-inner { width: 100%; padding: calc(18px + var(--st)) 16px calc(16px + var(--sb)); justify-content: space-between; align-items: center; gap: 0; }
  .title-top { text-align: center; }
  .logo.logo-img img { width: min(340px, 86vw); margin: 0 auto; }
  .logo-sub { font-size: 13px; }
  .hero-stage { right: 50%; transform: translateX(50%); width: 88vw; height: 62vh; bottom: 12vh; }
  .hero { filter: drop-shadow(0 0 22px rgba(60,180,255,.35)); }
  .acct { align-self: center; }
  .title-menu { align-items: center; width: 100%; padding: 18px 12px 6px; background: linear-gradient(transparent, rgba(4,6,15,.85) 30%); }
  .tbtn { min-width: min(300px, 100%); }
  .title-foot { justify-content: center; text-align: center; }
  #title.creating .title-inner, #title.selecting .title-inner { justify-content: flex-start; gap: 10px; }
  #title.creating .logo.logo-img img, #title.selecting .logo.logo-img img { width: min(220px, 60vw); }
  .inv-grid { grid-template-columns: repeat(5, 1fr); }
  .st-grid { grid-template-columns: 1fr; }
  .eq-wrap { grid-template-columns: minmax(0, 1fr) 104px minmax(0, 1fr); gap: 6px; }
  body #w-equip .eq-prev { width: 104px; height: 136px; }
}

/* มือถือแนวนอน (จอเตี้ย) */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --gap: 6px; }
  #basic-info { width: 236px; padding: 6px 8px 6px 6px; gap: 7px; }
  .bi-face, .bi-face canvas { width: 40px; height: 46px; }
  .bi-id b { font-size: 12px; }
  .gauge { height: 12px; } .gauge i, .gauge span { line-height: 12px; font-size: 9px; }
  .gauge.sp { height: 9px; } .gauge.sp i, .gauge.sp span { line-height: 9px; font-size: 8px; }
  .bi-foot { display: none; }
  #buffs { top: calc(96px + var(--st)); }
  #quest-track { top: calc(128px + var(--st)); width: 220px; font-size: 11.5px; padding: 4px 8px 5px; }
  #minimap { width: 92px; }
  .mm-ring { width: 86px; height: 86px; padding: 3px; }
  .mm-sub { display: none; }
  #map-name { font-size: 9px; line-height: 13px; }
  .mm-btn { width: 26px; height: 26px; }
  #map-open { left: -14px; top: 62px; }
  #zoom-ctl button:nth-child(1) { left: -18px; top: 0; }
  #zoom-ctl button:nth-child(2) { left: -26px; top: 30px; }
  #menubar { top: calc(var(--gap) + var(--st)); right: calc(134px + var(--sr)); }
  .pad-mode #menubar { flex-direction: row-reverse; }
  #hud-toggle { left: calc(250px + var(--sl)); top: calc(6px + var(--st)); }
  #chat { width: min(40vw, 340px); left: 50%; transform: translateX(-50%); top: calc(58px + var(--st)); bottom: auto; }
  #chat-log { height: 56px; font-size: 11px; }
  .pad-mode #chat { bottom: auto; }
  .pad-mode #chat-btn { left: calc(120px + var(--sl)); bottom: calc(150px + var(--sb)); }
  .pad-mode #potbar { flex-direction: row; flex-wrap: wrap; width: 100px; bottom: calc(150px + var(--sb)); gap: 6px; }
  .pad-mode #potbar .hb { width: 44px; height: 44px; }
  .pad-mode #auto-btn { right: calc(250px + var(--sr)); bottom: calc(14px + var(--sb)); width: 50px; height: 50px; }
  #joy-zone { height: min(60vh, 240px); }
  body:not(.pad-mode) #dock { left: auto; right: calc(8px + var(--sr)); transform: none; padding: 4px 6px; }
  body:not(.pad-mode) #dock .hb { width: 40px; height: 40px; }
  #announce { top: calc(40px + var(--st)); font-size: 13px; }
  #target { top: calc(6px + var(--st)); width: 200px; }
  #nav-pill { top: calc(100px + var(--st)); left: calc(6px + var(--sl)); transform: none; font-size: 12px; }
  .win { max-height: calc(100dvh - 12px - var(--st) - var(--sb)) !important; top: calc(6px + var(--st)) !important; width: min(440px, calc(100vw - 120px)) !important;
    left: calc(8px + var(--sl)) !important; right: auto !important; transform: none !important; }
  .win.dialog { left: 50% !important; transform: translateX(-50%) !important; top: auto !important; bottom: calc(6px + var(--sb)); }
  .create { flex-direction: row; }
  .cr-left canvas { width: 150px; height: 176px; }
  .logo { font-size: 40px; }
  .logo.logo-img img { width: min(300px, 40vw); }
  .title-inner { gap: 10px; padding-top: calc(10px + var(--st)); }
  .tbtn { padding: 8px 20px; font-size: 15px; min-width: 240px; }
  .hero-stage { height: 96vh; width: 40vw; }
  #title.creating .logo.logo-img img, #title.selecting .logo.logo-img img { width: 160px; }
}

/* ต้นไม้พาสซีฟ */
.pt-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.pt-head b { color: #ffd86a; font-size: 15px; }
.pt-zoom { display: flex; gap: 4px; flex-wrap: wrap; }
.pt-zoom .btn { min-width: 34px; padding: 4px 8px; }
.pt-wrap { position: relative; }
.pt-cv { display: block; width: 100%; height: min(62vh, 560px); touch-action: none; cursor: grab; border: 1px solid var(--line-2); }
.pt-info { position: absolute; left: 8px; bottom: 8px; max-width: min(300px, calc(100% - 16px)); display: grid; gap: 3px; padding: 9px 11px;
  background: rgba(6,11,20,.9); border: 1px solid var(--line-2); font-size: 12.5px; }
.pt-info b { font-size: 14px; } .pt-info small { color: var(--ink-dim); }
.pt-info .ks { color: #ffb08a; } .pt-info .dim { color: var(--ink-dim); }
.pt-info .btn { margin-top: 5px; justify-self: start; }
.pt-info .btn.primary { border-color: #ffd86a; color: #ffd86a; box-shadow: 0 0 10px rgba(255,216,106,.25); }
.st-sub { margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--line); color: var(--cy); font-size: 12px; }
.st-ks { font-size: 11.5px; color: #ffb08a; line-height: 1.35; }
.st-ks b { color: #ffd0b0; }
.sk-mas { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-dim); margin-top: 3px; }
.sk-mas i { flex: 1; max-width: 120px; height: 5px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; }
.sk-mas i b { display: block; height: 100%; background: linear-gradient(90deg, #4fc6ff, #9ff0ff); }
.sk-mas em { font-style: normal; color: #9ff0ff; font-weight: 600; }
#title-ver { position: absolute; right: 12px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 3; font-size: 11.5px; color: rgba(200,225,255,.55); pointer-events: none; }
#auto-btn.locked { opacity: .5; filter: grayscale(.6); }

/* ---------------- ล่าเก็บเลเวล (หน้าต่างนำทาง) ---------------- */
.hunt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 12px; margin-bottom: 2px; border-radius: 14px; background: rgba(111,243,255,.08); border: 1px solid rgba(111,243,255,.22); }
.hunt-head b { font: 600 14px var(--display, inherit); color: var(--ink); }
.hunt-head span { font-size: 12px; color: var(--cy); }
.hunt-sec { display: flex; align-items: baseline; gap: 8px; padding: 10px 4px 2px; }
.hunt-sec b { font-size: 12.5px; font-weight: 600; letter-spacing: .02em; }
.hunt-sec span { font-size: 11px; color: var(--ink-dim); }
.hunt-sec.good b { color: #7dffb4; } .hunt-sec.hard b { color: #ff9aa8; } .hunt-sec.mvp b { color: #ffd05a; } .hunt-sec.easy b { color: var(--ink-dim); }
.hunt-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px 6px 6px; text-align: left; color: var(--ink); cursor: pointer;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; transition: background .15s, border-color .15s; }
.hunt-row:hover { background: rgba(111,243,255,.1); border-color: rgba(111,243,255,.4); }
.hunt-row.good { border-left: 3px solid rgba(125,255,180,.7); }
.hunt-row.hard { border-left: 3px solid rgba(255,107,125,.6); }
.hunt-row.mvp { border-left: 3px solid rgba(255,208,90,.7); }
.hunt-row.easy { opacity: .62; }
.hunt-row.here .hunt-s { color: var(--cy); }
.hunt-pic { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: radial-gradient(circle at 50% 60%, rgba(255,255,255,.1), rgba(0,0,0,.25)); overflow: hidden; }
.hunt-pic img { max-width: 38px; max-height: 38px; object-fit: contain; image-rendering: auto; }
.hunt-pic i { width: 18px; height: 18px; border-radius: 50%; }
.hunt-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hunt-n { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hunt-s { font-size: 11px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hunt-tag { font-size: 9.5px; font-weight: 600; padding: 1px 7px; border-radius: var(--rad-pill, 4px); }
.hunt-tag.bad { color: #ffb3bd; background: rgba(255,79,106,.16); border: 1px solid rgba(255,79,106,.35); }
.hunt-r { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-variant-numeric: tabular-nums; }
.hunt-r b { font-size: 12.5px; font-weight: 600; }
.hunt-r small { font-size: 10.5px; color: #ffe08a; }
.hunt-info { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--mono, monospace); font-style: italic; color: var(--cy); border: 1px solid rgba(111,243,255,.35); }
.hunt-info:hover { background: rgba(111,243,255,.15); }

/* ---------------- เทียบไอเทมก่อนเปลี่ยน ---------------- */
.cmp-row { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 10px; margin: 4px 0; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.cmp-row .cmp-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11.5px; }
.cmp-row .cmp-h span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-v { flex: none; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: var(--rad-pill, 4px); }
.cmp-v.up { color: #0b2a17; background: #7dffb4; } .cmp-v.down { color: #3a0a12; background: #ff8a99; }
.cmp-v.mix { color: #2e2207; background: #ffd56a; } .cmp-v.eq { color: var(--ink-dim); background: rgba(255,255,255,.08); }
.cmp-v.no { color: #ffb3bd; background: rgba(255,79,106,.16); border: 1px solid rgba(255,79,106,.4); }
.cmp-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.cmp-chips .cmp { display: inline-flex; align-items: baseline; gap: 4px; font: 600 11.5px var(--mono, monospace); padding: 2px 8px; border-radius: var(--rad-pill, 4px); font-variant-numeric: tabular-nums; }
.cmp-chips .cmp i { font-style: normal; font-weight: 500; opacity: .75; font-size: 10px; }
.cmp-chips .cmp small { font-weight: 500; opacity: .7; }
.cmp-chips .cmp.up { color: #9dffc6; background: rgba(125,255,180,.1); }
.cmp-chips .cmp.down { color: #ffa3ad; background: rgba(255,107,125,.1); }
.cmp-row.compact { padding: 5px 7px; gap: 4px; margin: 3px 0 0; }
.cmp-row.compact .cmp-h { font-size: 10.5px; }
.shop-n .cmp-row { font-size: inherit; }
.cmp-row.compact { flex-direction: row; flex-wrap: wrap; align-items: center; background: none; border: 0; padding: 0; margin-top: 4px; }
.cmp-row.compact .cmp-h span { display: none; }

/* ---------------- บอท: เลือกมอนที่จะล่า ---------------- */
.bot-mobs { display: flex; flex-direction: column; gap: 6px; }
.bm-head { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-dim); }
.bm-head span { flex: 1; min-width: 0; }
.bm-head .linkbtn { font-size: 12px; color: var(--cy); padding: 2px 0; }
.bm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.bm-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px 7px; border-radius: 16px; cursor: pointer; color: var(--ink);
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); opacity: .55; filter: grayscale(.7); transition: opacity .15s, filter .15s, border-color .15s, background .15s; }
.bm-card.on { opacity: 1; filter: none; border-color: rgba(111,243,255,.5); background: rgba(111,243,255,.09); box-shadow: inset 0 0 0 1px rgba(111,243,255,.12); }
.bm-card:hover { border-color: rgba(111,243,255,.6); }
.bm-pic { width: 44px; height: 44px; display: grid; place-items: center; }
.bm-pic img { max-width: 44px; max-height: 44px; object-fit: contain; }
.bm-pic i { width: 18px; height: 18px; border-radius: 50%; }
.bm-card b { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; }
.bm-card small { font-size: 10px; color: var(--ink-dim); text-align: center; }
.bm-chk { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  border: 1px solid rgba(255,255,255,.25); color: #04121f; }
.bm-card.on .bm-chk { background: var(--cy); border-color: transparent; }

/* ---------------- ใช้สกิลแบบ RO: โหมดเล็ง + ดีเลย์วงกวาด ---------------- */
.hb .cd { display: grid; place-items: center; font: 600 11px var(--mono, monospace); color: #fff; text-shadow: 0 1px 2px #000;
  background: conic-gradient(rgba(6,10,18,.72) calc(var(--cd, 0) * 360deg), rgba(6,10,18,0) 0) !important; border-radius: inherit; }
.hb.aiming { outline: 2px solid #ffe078; outline-offset: 1px; box-shadow: 0 0 16px rgba(255,224,120,.55) !important; animation: aimPulse 1s ease-in-out infinite; }
@keyframes aimPulse { 50% { outline-color: rgba(255,224,120,.35); } }
#skill-aim { position: fixed; left: 50%; top: calc(64px + var(--st, 0px)); transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 6px; border-radius: var(--rad-pill, 4px); background: rgba(10,16,26,.78); border: 1px solid rgba(255,224,120,.55); color: var(--ink);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 10px 26px -12px rgba(0,0,0,.9); max-width: calc(100vw - 24px); }
#skill-aim[hidden] { display: none; }
#skill-aim .sa-ic .sicon { width: 30px; height: 30px; border-radius: 50%; }
#skill-aim .sa-t { font-size: 12.5px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#skill-aim .sa-t b { color: #ffe9a8; margin-right: 6px; }
#skill-aim #sa-x { flex: none; border-radius: var(--rad-pill, 4px); padding: 5px 12px; font-size: 12px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); color: var(--ink); cursor: pointer; }
@media (max-width: 760px) { #skill-aim { top: calc(132px + var(--st, 0px)); } #skill-aim .sa-t { font-size: 11.5px; white-space: normal; } }

/* ---------------- บทสนทนา: ใช้คีย์บอร์ดได้ ---------------- */
.dlg-opt { display: flex; align-items: center; gap: 10px; }
.dlg-opt kbd, .dlg-btns kbd { flex: none; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; display: inline-grid; place-items: center;
  font: 600 10.5px var(--mono, monospace); color: var(--ink-dim); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); }
.dlg-btns kbd { margin-left: 8px; }
.dlg-opt.kbd { border-color: rgba(111,243,255,.6) !important; background: rgba(111,243,255,.12) !important; box-shadow: inset 3px 0 0 var(--cy); }
.dlg-opt.kbd kbd { color: #04121f; background: var(--cy); border-color: transparent; }

/* บอท: เงื่อนไขใช้สกิลรายตัว */
.bot-skill-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bot-skill-row .bot-skill { flex: 1; min-width: 0; }
.bot-gate { flex: none; font: 500 12px var(--font, inherit); color: var(--ink); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16); border-radius: var(--rad-pill, 4px); padding: 4px 10px; }

/* ---------------- ลานประลอง PvP ---------------- */
#pvp-hud { position: fixed; left: 50%; top: calc(8px + var(--st, 0px)); transform: translateX(-50%); z-index: 25; display: flex; align-items: center; gap: 12px;
  padding: 6px 14px; border-radius: var(--rad-pill, 4px); background: rgba(40, 10, 18, .72); border: 1px solid rgba(255, 107, 125, .45); color: var(--ink);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-size: 12.5px; white-space: nowrap; pointer-events: none; }
#pvp-hud[hidden] { display: none; }
#pvp-hud b { color: #ffb3bd; font-weight: 600; }
#pvp-hud i { font-style: normal; font-weight: 700; color: #fff; font-family: var(--mono, monospace); }
#pvp-hud .pv-n { color: var(--ink-dim); }
@media (min-width: 761px) { #hud:has(#pvp-hud:not([hidden])) #target { top: calc(48px + var(--st, 0px)); } }
@media (max-width: 760px) { #pvp-hud { top: calc(96px + var(--st, 0px)); font-size: 11.5px; gap: 8px; } }
.sk-mas-help { font-size: 12px; line-height: 1.5; color: var(--ink-dim); padding: 8px 12px; margin: 0 0 8px; border-radius: 14px; background: rgba(111,243,255,.07); border: 1px solid rgba(111,243,255,.2); }
.sk-mas-help b { color: var(--cy); }
.inv-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.inv-foot .inv-sort { border-radius: var(--rad-pill, 4px); padding: 4px 14px; }

/* คูลดาวน์บอส (ใต้มินิแมพ) */
#mm-mvp { margin-top: 4px; max-width: 100%; padding: 2px 10px; border-radius: var(--rad-pill, 4px); font: 600 10.5px var(--mono, monospace); color: #ffd98a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(40, 26, 8, .66); border: 1px solid rgba(255, 208, 90, .4); font-variant-numeric: tabular-nums; }
#mm-mvp[hidden] { display: none; }
#mm-mvp.alive { color: #ffb3bd; background: rgba(60, 10, 20, .7); border-color: rgba(255, 107, 125, .55); animation: mvpPulse 1.2s ease-in-out infinite; }
@keyframes mvpPulse { 50% { box-shadow: 0 0 12px rgba(255, 79, 106, .6); opacity: .8; } }
#hud.hud-min #mm-mvp { display: none; }
@media (max-width: 760px) { #mm-mvp { font-size: 9.5px; padding: 1px 7px; } }

/* ---------------- เรื่องราว: บทนำ (บทที่ 0) ---------------- */
#prologue { position: fixed; inset: 0; z-index: 9500; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; overflow: hidden;
  padding: calc(24px + var(--st)) 24px calc(28px + var(--sb)); background: #04060f; color: var(--ink); cursor: pointer; opacity: 0; transition: opacity .9s ease; }
#prologue.show { opacity: 1; }
#prologue.leaving { opacity: 0; transition: opacity .7s ease; pointer-events: none; }
.pl-bg { position: absolute; inset: 0; pointer-events: none; opacity: .45; transition: opacity 1.8s ease;
  background: radial-gradient(60% 42% at 50% 112%, rgba(98,227,255,.18), rgba(98,227,255,0) 70%), radial-gradient(70% 50% at 50% -24%, rgba(255,224,138,.06), transparent 70%); }
#prologue.lit .pl-bg { opacity: 1; }
#prologue.welcome .pl-bg { opacity: 1; background: radial-gradient(70% 50% at 50% 112%, rgba(98,227,255,.24), rgba(98,227,255,0) 70%), radial-gradient(80% 55% at 50% -24%, rgba(255,224,138,.1), transparent 70%); }
.pl-kicker { position: relative; display: flex; align-items: center; gap: 10px; font: 600 11px/1 var(--mono, ui-monospace, monospace); letter-spacing: .26em; color: var(--cy); }
.pl-kicker span { font: 500 13px/1 var(--font); letter-spacing: 0; color: var(--ink-dim); }
.pl-visor { position: relative; width: min(420px, 70vw); height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--cy), transparent); opacity: .12; transform: scaleX(.22);
  transition: opacity 1.4s ease, transform 1.4s cubic-bezier(.2,.8,.2,1), box-shadow 1.4s ease; }
#prologue.lit .pl-visor { opacity: 1; transform: scaleX(1); box-shadow: 0 0 18px var(--cy-glow), 0 0 56px rgba(98,227,255,.28); }
#prologue.welcome .pl-visor { animation: plBreath 3s ease-in-out infinite; }
.pl-lines { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; width: min(600px, 100%); min-height: min(42vh, 380px); }
.pl-line { margin: 0; text-align: center; font: 400 clamp(16px, 2.2vw, 20px)/1.65 var(--font); color: var(--ink); text-wrap: balance; opacity: 0; transform: translateY(10px);
  transition: opacity .9s ease, transform .9s cubic-bezier(.2,.8,.2,1); }
.pl-line.in { opacity: 1; transform: none; }
.pl-line.in.past { opacity: .38; }
.pl-line .nb { white-space: nowrap; }
.pl-line.pl-final { margin-top: 8px; font: 600 clamp(19px, 3vw, 27px)/1.5 var(--display); color: #fff; letter-spacing: .01em; text-shadow: 0 0 24px var(--cy-glow), 0 2px 6px rgba(0,0,0,.6); }
.pl-dots { position: relative; display: flex; gap: 8px; }
.pl-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.16); transition: background .4s, box-shadow .4s; }
.pl-dots i.on { background: var(--cy); box-shadow: 0 0 8px var(--cy); }
.pl-hint { position: relative; font: 500 11.5px/1 var(--mono, ui-monospace, monospace); letter-spacing: .14em; color: var(--ink-dim); animation: plHint 2.6s ease-in-out infinite; }
.pl-skip { position: absolute; right: calc(16px + var(--sr)); top: calc(14px + var(--st)); z-index: 2; padding: 8px 16px; border-radius: var(--rad-pill, 4px); border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06); color: var(--ink-dim); font: 500 13px/1.2 var(--font); transition: color .15s, border-color .15s, background .15s; }
.pl-skip::after { content: " ▸"; }
.pl-skip:hover { color: #fff; border-color: rgba(98,227,255,.5); background: rgba(98,227,255,.1); }
@keyframes plHint { 50% { opacity: .35; } }
@keyframes plBreath { 50% { opacity: .55; box-shadow: 0 0 10px var(--cy-glow); } }
@media (max-height: 520px) {
  #prologue { gap: 10px; }
  .pl-lines { gap: 7px; min-height: 0; }
  .pl-line { font-size: 14.5px; line-height: 1.5; }
  .pl-line.pl-final { font-size: 18px; margin-top: 2px; }
}
@media (prefers-reduced-motion: reduce) { .pl-hint, #prologue.welcome .pl-visor { animation: none; } .pl-line, .pl-visor, .pl-bg { transition-duration: .2s; } }

/* ---------------- เรื่องราว: บรรทัดตำนานใต้ชื่อแผนที่ / บทในหน้าต่างเควสต์ ---------------- */
.mb-story { margin: 8px auto 0; max-width: min(540px, 88vw); font: 400 14px/1.5 var(--font); color: rgba(230,241,251,.94); text-shadow: 0 0 8px #000, 0 1px 2px #000; white-space: normal; text-wrap: balance; }
/* แบนเนอร์แบบมีภาพ: ขอบล่างถูกมาสก์ให้จาง → ดันข้อความขึ้นและจำกัดความกว้างให้อยู่ในโซนทึบของมาสก์ */
#map-banner.has-img .mb-story { font-size: 13.5px; max-width: 72%; margin-top: 6px; }
#map-banner.has-img.story { padding-bottom: 28px; }
#map-banner.story.show { animation-duration: 4.8s; }
@media (max-width: 760px) {
  .mb-story { font-size: 12.5px; }
  #map-banner.has-img.story { aspect-ratio: 3 / 1.8; max-height: 48vh; padding-bottom: 34px; }
  #map-banner.has-img .mb-story { max-width: 78%; }
}
.q-chapter { font: 600 10.5px/1.2 var(--mono, ui-monospace, monospace); letter-spacing: .18em; color: var(--cy); margin-bottom: 4px; }

/* ---------------- ปาร์ตี้: แถบสมาชิก (ซ้าย ใต้เควสต์) • หน้าต่าง Y • โทสต์คำเชิญ ---------------- */
.cl.party { color: #7dffd8; }
#party-hud { position: fixed; left: calc(var(--gap) + var(--sl)); top: calc(222px + var(--st)); z-index: 19; width: 200px; display: flex; flex-direction: column; gap: 2px;
  padding: 4px; background: linear-gradient(100deg, rgba(10,20,38,.85), rgba(7,13,24,.45)); border-left: 2px solid #3dffc8; }
#party-hud[hidden], #hud.hud-min #party-hud { display: none; }
#hud:has(#quest-track[hidden]) #party-hud { top: calc(160px + var(--st)); }
#party-hud button { font: inherit; color: var(--ink); background: none; border: 0; text-align: left; cursor: pointer; }
.ph-head { display: flex; align-items: center; gap: 6px; padding: 2px 6px; min-width: 0; }
.ph-k { font: 600 10px var(--mono, monospace); letter-spacing: .18em; color: #3dffc8; flex: none; }
.ph-name { flex: 1; min-width: 0; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-n { flex: none; font: 500 10.5px var(--mono, monospace); color: var(--ink-dim); }
.ph-chev { flex: none; width: 7px; height: 7px; border-right: 1.5px solid var(--ink-dim); border-bottom: 1.5px solid var(--ink-dim); transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
#party-hud.folded .ph-chev { transform: translateX(-1px) rotate(-45deg); } /* พับ = ▸ เหมือนปุ่มพับแผงอื่น */
.ph-list { display: flex; flex-direction: column; gap: 2px; }
.ph-row { display: flex; flex-direction: column; gap: 3px; padding: 4px 6px 5px; min-width: 0; border-radius: 8px; }
.ph-row:hover { background: rgba(98,227,255,.1); }
.ph-top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.ph-top b { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-top small { flex: none; max-width: 92px; font: 500 10.5px var(--mono, monospace); color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-top svg { width: 13px; height: 13px; flex: none; }
.ph-crown { display: inline-flex; flex: none; color: #ffd34a; }
.ph-crown svg { fill: rgba(255,211,74,.35); stroke-width: 1.6; }
.ph-bars { display: grid; gap: 2px; }
.ph-bars i { display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,.14); overflow: hidden; }
.ph-bars i.sp { height: 2px; }
.ph-bars b { display: block; height: 100%; width: 0; border-radius: inherit; background: #5fe08a; transition: width .25s ease-out; }
.ph-bars i.low b { background: #ff4f6a; }
.ph-bars i.sp b { background: #6ff3ff; }
.ph-row.off .ph-top b { color: var(--ink-dim); }
.ph-row.dead { opacity: .55; } .ph-row.dead .ph-top b { text-decoration: line-through; }
.ph-add .ph-top { color: #3dffc8; font-size: 12px; } .ph-add .ph-top b { color: #bfffee; font-weight: 500; }
/* คนเยอะ (4-5 คน) บนจอคอม: แถวบรรทัดเดียว ชื่อซ้าย หลอดขวา ไม่ล้นลงไปทับแชท */
@media (min-width: 761px) and (min-height: 521px) {
  #party-hud[data-n="4"] .ph-row, #party-hud[data-n="5"] .ph-row { flex-direction: row; align-items: center; gap: 8px; padding-top: 3px; padding-bottom: 3px; }
  #party-hud[data-n="4"] .ph-top, #party-hud[data-n="5"] .ph-top { flex: 1; }
  #party-hud[data-n="4"] .ph-row:not(.off) .ph-top small, #party-hud[data-n="5"] .ph-row:not(.off) .ph-top small { display: none; }
  #party-hud[data-n="4"] .ph-bars, #party-hud[data-n="5"] .ph-bars { flex: none; width: 64px; }
}
@media (max-width: 760px) {
  #party-hud, #hud:has(#quest-track[hidden]) #party-hud { left: auto; right: calc(var(--gap) + var(--sr)); top: calc(236px + var(--st)); width: 136px; }
  .ph-top b { font-size: 11.5px; } .ph-top small { max-width: 56px; font-size: 9.5px; }
  .pad-mode #hud:has(#party-hud:not([hidden])) #chat { width: min(58vw, 236px); }
  #hud:has(#menubar:not(.folded)) #party-hud { visibility: hidden; }
}
@media (max-height: 520px) and (orientation: landscape) {
  #party-hud, #hud:has(#quest-track[hidden]) #party-hud { left: auto; right: calc(var(--gap) + var(--sr)); top: calc(110px + var(--st)); width: 128px; gap: 1px; padding: 3px; }
  #party-hud[data-n="3"], #party-hud[data-n="4"] { width: 252px; }
  #party-hud[data-n="5"] { width: 372px; }
  #party-hud[data-n="3"] .ph-list, #party-hud[data-n="4"] .ph-list { display: grid; grid-template-columns: 1fr 1fr; }
  #party-hud[data-n="5"] .ph-list { display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .ph-head { padding: 1px 6px; } .ph-row { padding: 2px 6px 3px; gap: 2px; }
  .ph-top b { font-size: 11px; } .ph-top small { max-width: 50px; font-size: 9.5px; }
}

/* หน้าต่างปาร์ตี้ */
.py-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 6px 4px 4px; }
.py-empty > b { font-size: 15px; }
.py-empty p { margin: 0; max-width: 300px; font-size: 12.5px; line-height: 1.5; color: var(--ink-dim); }
.py-empty p.py-dim { font-size: 11.5px; opacity: .8; }
.py-hero { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; color: #3dffc8; background: radial-gradient(circle, rgba(61,255,200,.2), rgba(61,255,200,.04) 70%);
  box-shadow: inset 0 0 0 1px rgba(61,255,200,.35), 0 0 26px -6px rgba(61,255,200,.5); }
.py-hero svg { width: 28px; height: 28px; }
.py-create { display: flex; gap: 6px; width: 100%; margin-top: 6px; }
.py-create input { flex: 1; min-width: 0; font: 13px var(--font); padding: 6px 10px; color: var(--ink); background: rgba(0,0,0,.35); border: 1px solid var(--line-2); outline: none; }
.py-create input:focus { border-color: var(--cy); }
.py-create .py-go { flex: none; }
.py-sec { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 14px 2px 6px; }
.py-sec span { font: 600 12px var(--display); color: var(--cy); }
.py-sec small { font-size: 11px; color: var(--ink-dim); }
.py-near, .py-list { display: flex; flex-direction: column; gap: 5px; }
.py-near { max-height: min(30vh, 220px); overflow-y: auto; }
.py-nrow, .py-row { display: flex; align-items: center; gap: 10px; padding: 7px 9px; background: rgba(255,255,255,.04); border: 1px solid rgba(110,200,255,.14); }
.py-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.py-mid > b, .py-n b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.py-mid > small, .py-s { font-size: 11px; color: var(--ink-dim); white-space: nowrap; }
.py-n .py-s { flex: none; margin-left: auto; padding-left: 6px; }
.py-none { padding: 8px 4px; font-size: 12px; color: var(--ink-dim); line-height: 1.5; }
.py-av { position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 40%, #0b1322), #070c16); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent); }
.py-av img { width: 24px; height: 24px; object-fit: contain; }
.py-av > i:not(.py-crown) { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.py-av .py-crown { position: absolute; right: -6px; top: -7px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: #ffd34a; background: #0a101c; box-shadow: 0 0 0 1px rgba(255,211,74,.5); }
.py-av .py-crown svg { width: 12px; height: 12px; fill: rgba(255,211,74,.4); stroke-width: 1.8; }
.py-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
@media (min-width: 761px) and (min-height: 521px) { #w-party { max-height: calc(100dvh - 212px - var(--sb)); } }
.py-count { font: 600 13px var(--mono, monospace); color: var(--ink-dim); white-space: nowrap; }
.py-count b { font-size: 24px; color: #fff; }
.py-share { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.py-share b { font-size: 12.5px; color: #3dffc8; }
.py-share small { font-size: 11px; color: var(--ink-dim); }
.py-row.me { border-color: rgba(98,227,255,.4); }
.py-row.off .py-av { filter: grayscale(.6); opacity: .75; }
.py-row.dead { opacity: .6; }
.py-n { display: flex; align-items: center; gap: 6px; min-width: 0; }
.py-n em, .py-lead { flex: none; font: 600 9.5px var(--mono, monospace); font-style: normal; letter-spacing: .06em; padding: 1px 6px; border-radius: var(--rad-pill, 4px); color: var(--cy); background: rgba(98,227,255,.12); }
.py-lead { color: #ffd34a; background: rgba(255,211,74,.12); }
.py-bars { display: grid; gap: 3px; margin-top: 4px; }
.py-bar { display: grid; grid-template-columns: 1fr 62px; align-items: center; gap: 8px; }
.py-bar i { display: block; height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.py-bar.sp i { height: 3px; }
.py-bar b { display: block; height: 100%; border-radius: inherit; background: #5fe08a; }
.py-bar.low b { background: #ff4f6a; }
.py-bar.sp b { background: #6ff3ff; }
.py-bar em { font: 500 10px var(--mono, monospace); font-style: normal; color: var(--ink-dim); text-align: right; white-space: nowrap; }
.py-map { display: flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 11.5px; color: #c6b0ff; min-width: 0; }
.py-map svg { width: 12px; height: 12px; flex: none; }
.py-map span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.py-kick, .py-inv { flex: none; }
.py-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(110,200,255,.14); }
.py-foot .hint { margin: 0; flex: 1; min-width: 0; line-height: 1.45; }
.py-leave { flex: none; }

/* โทสต์คำเชิญเข้าปาร์ตี้ */
#party-invite { position: fixed; left: 50%; top: calc(108px + var(--st)); transform: translateX(-50%); z-index: 900; width: min(470px, calc(100vw - 20px));
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 12px 12px 14px; color: var(--ink);
  background: rgba(7,13,24,.94); border: 1px solid rgba(61,255,200,.5); box-shadow: 0 16px 40px -12px rgba(0,0,0,.9); animation: pinvIn .35s cubic-bezier(.2,.8,.2,1) both; }
#party-invite[hidden] { display: none; }
@keyframes pinvIn { from { opacity: 0; transform: translate(-50%, -10px); } }
.pinv-ic { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: #3dffc8; background: rgba(61,255,200,.12); box-shadow: inset 0 0 0 1px rgba(61,255,200,.4); }
.pinv-ic svg { width: 22px; height: 22px; }
.pinv-t { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 1px; font-size: 13px; line-height: 1.4; }
.pinv-t small { font-size: 11px; font-weight: 600; color: #3dffc8; }
.pinv-t b { color: #fff; }
.pinv-btns { flex: none; display: flex; gap: 6px; margin-left: auto; }
.pinv-btns .btn { min-width: 64px; padding: 7px 14px; font-size: 13px; }
.pinv-yes { color: #04121f !important; background: linear-gradient(#8fffe0, #3dd8b0) !important; border-color: rgba(255,255,255,.4) !important; }
.pinv-bar { position: absolute; left: 16px; right: 16px; bottom: 5px; height: 2px; border-radius: 1px; background: rgba(255,255,255,.08); overflow: hidden; }
.pinv-bar b { display: block; height: 100%; background: #3dffc8; transform-origin: left; animation: pinvBar linear forwards; }
@keyframes pinvBar { to { transform: scaleX(0); } }
@media (max-width: 760px) {
  #party-invite { top: calc(150px + var(--st)); }
  .pinv-btns { width: 100%; } .pinv-btns .btn { flex: 1; padding: 9px 14px; font-size: 14px; }
}
@media (max-height: 520px) and (orientation: landscape) { #party-invite { top: calc(56px + var(--st)); } }
/* World Boss (ใต้ป้าย MVP) */
#mm-wb { margin-top: 3px; max-width: 100%; padding: 2px 10px; border-radius: var(--rad-pill, 4px); font: 600 10.5px var(--mono, monospace); color: #e6c8ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(30, 14, 46, .7); border: 1px solid rgba(200, 140, 255, .45); font-variant-numeric: tabular-nums; }
#mm-wb[hidden] { display: none; }
#mm-wb.alive { color: #ffe08a; background: rgba(70, 30, 6, .78); border-color: rgba(255, 200, 80, .7); animation: mvpPulse 1.2s ease-in-out infinite; }
#hud.hud-min #mm-wb { display: none; }
@media (max-width: 760px) { #mm-wb { font-size: 9.5px; padding: 1px 7px; } }

/* ===== หน้าเลือกตัวละคร (หลายตัวละครต่อบัญชี) — โครงพื้นฐาน หน้าตาหลักอยู่ใน visor.css ===== */
.charsel { display: flex; gap: 16px; width: min(820px, 100%); max-height: calc(100dvh - 40px - var(--st) - var(--sb)); }
.cs-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cs-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; }
.cs-slot { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; color: var(--ink); background: rgba(0,0,0,.35); border: 1px solid var(--line); padding: 6px 12px 6px 6px; }
.cs-slot.on { border-color: var(--cy); }
.cs-btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.cs-links { display: flex; flex-direction: column; align-items: flex-start; }
/* แผนที่โลกตามภูมิศาสตร์จริง (ui.js renderWorld + js/world.js) */
.wm-geo { position: relative; max-width: 640px; margin: 0 auto; }
.wm-card.wm-abs { position: absolute; min-height: 0; padding: 4px 6px; border-radius: 6px; background-size: cover; background-position: center; overflow: hidden; }
.wm-card.wm-abs b { font-size: 11.5px; line-height: 1.1; }
.wm-card.wm-abs small { font-size: 10px; }
.wm-gate { position: absolute; z-index: 2; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #62e3ff; box-shadow: 0 0 0 2px rgba(4,10,20,.8), 0 0 10px #62e3ff; pointer-events: none; }
.wm-me { position: absolute; z-index: 3; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #ffd34a; box-shadow: 0 0 0 2px #1a1206, 0 0 14px #ffd34a; pointer-events: none; animation: wmMe 1.2s ease-in-out infinite; }
@keyframes wmMe { 50% { transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) { .wm-me { animation: none; } }
/* แผนที่ใหญ่ (M): กรอบแผนที่ภาพวาด */
#bigmap-cv { display: block; width: 100%; height: auto; margin: 0 auto; border-radius: 10px; border: 2px solid rgba(215,178,90,.85); box-shadow: 0 0 0 3px rgba(20,14,4,.85), 0 0 0 4px rgba(215,178,90,.35), 0 10px 30px rgba(0,0,0,.5); background: #1a140a; cursor: crosshair; }
#worldmap-cv { display: block; width: 100%; height: auto; margin: 0 auto; border-radius: 10px; border: 2px solid rgba(215,178,90,.85); box-shadow: 0 0 0 3px rgba(20,14,4,.85), 0 10px 30px rgba(0,0,0,.5); background: #16120a; cursor: pointer; }
/* เดินข้ามขอบแมพ (ขอบเปิด): ป้ายชื่อเล็กมุมบน ไม่บังจอ */
#map-banner.mini { top: 14%; transform: translateX(-50%) scale(.62); }
