/* Classic PC MMO client look: small type, blue gradient title bars, pale panels, pill buttons. */
:root {
  /* ฟอนต์ของเกม (assets/fonts/fonts.css) — เดิม Tahoma มาก่อน: Windows ได้ฟอนต์ระบบรุ่นเก่า
     มือถือได้ Sarabun แต่ละเครื่องหน้าตาคนละแบบ และไม่เข้ากับโลโก้ที่อ้วนกลม */
  --font: 'Anuphan', 'Sarabun', Tahoma, sans-serif;
  --font-head: 'Mitr', 'Anuphan', Tahoma, sans-serif;
  --ink: #1e2433;
  --ink-soft: #5d6680;
  --panel: #f7f9fd;
  --panel-2: #e9eef8;
  --line: #7f95c4;
  --line-soft: #c3cfe6;
  --title-a: #b9d0f4;
  --title-b: #5b82cb;
  --title-ink: #ffffff;
  --btn-a: #ffffff;
  --btn-b: #d7e0f1;
  --hp: #3c78e6;
  --hp-low: #e0443a;
  --sp: #3c78e6;
  --exp: #e8c24a;
  --jexp: #62c05a;
  --teal: #2f6f73;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9cc7a4; font-family: var(--font); font-size: 12px; color: var(--ink); -webkit-user-select: none; user-select: none; touch-action: none; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.small { font-size: 11px; color: var(--ink-soft); }

/* ── login ─────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, rgba(255, 250, 235, .35), rgba(30, 40, 70, .55)); z-index: 50; padding: 16px; }
.login-card { width: min(360px, 100%); display: grid; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; box-shadow: 0 8px 30px rgba(0, 0, 0, .3); font-size: 13px; }
.brand { font: 700 28px/1 Georgia, serif; letter-spacing: 5px; color: #3f63a8; text-align: center; }
.sub { text-align: center; color: var(--ink-soft); }
.login-card label { display: grid; gap: 4px; font-weight: 700; }
.login-card input { font: inherit; font-size: 14px; padding: 7px 9px; border-radius: 3px; border: 1px solid var(--line); background: #fff; }
.row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.row > span { width: 50px; font-weight: 700; }
.chip { border: 1px solid var(--line); background: linear-gradient(var(--btn-a), var(--btn-b)); border-radius: 10px; padding: 3px 10px; font-size: 12px; }
.chip.on { background: linear-gradient(#7ea3e4, #4a72c0); color: #fff; }
.swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.swatches button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatches button.on { box-shadow: 0 0 0 3px #4a72c0; }
.primary { background: linear-gradient(#7ea3e4, #4a72c0); color: #fff; border: 1px solid #3a5a9a; border-radius: 14px; padding: 8px 18px; font-size: 14px; font-weight: 700; }
.err { color: #c0392b; min-height: 1em; }
.hint { font-size: 11px; color: var(--ink-soft); }
#l-auth, #l-create { display: grid; gap: 10px; }
/* ตัวอย่างตัวละครในหน้าสร้างตัวละคร — กล่องสูงคงที่ ฟอร์มจะได้ไม่กระตุกตอนโมเดลโหลดเสร็จ */
.cprev { position: relative; height: 188px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: linear-gradient(#eaf1fb, #dbe6f6); overflow: hidden; }
.cprev canvas { display: block; touch-action: none; cursor: grab; }
.cprev canvas:active { cursor: grabbing; }
.cprev span { position: absolute; font-size: 11px; color: var(--ink-soft); pointer-events: none; }
.row2 { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.acct { display: flex; gap: 6px; align-items: center; }
.acct b { flex: 1; }
.link { background: none; border: 0; color: #3f63a8; text-decoration: underline; font-size: 12px; cursor: pointer; }
.slots { display: grid; gap: 6px; }
.slot-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; background: #fff; }
.slot-card .nm { font-weight: 700; font-size: 14px; }
.slot-card .jb { color: var(--ink-soft); font-size: 12px; }
.slot-card.empty { color: var(--ink-soft); cursor: pointer; text-align: center; grid-template-columns: 1fr; border-style: dashed; background: transparent; }
.slot-card.empty:hover { background: #eef3fb; }
.slot-card .del { grid-column: 1 / -1; display: flex; gap: 6px; }
.slot-card .del input { flex: 1; min-width: 0; }

/* ── window chrome ─────────────────────────────────── */
.rwin, .win { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; box-shadow: 2px 2px 0 rgba(20, 30, 60, .18), 0 4px 14px rgba(0, 0, 0, .18); }
.rwin > header, .win > header {
  height: 19px; display: flex; align-items: center; justify-content: space-between; padding: 0 5px 0 7px;
  background: linear-gradient(var(--title-a), var(--title-b)); color: var(--title-ink); font-weight: 700; font-size: 11px;
  text-shadow: 0 1px 0 rgba(30, 50, 100, .7); border-radius: 3px 3px 0 0; border-bottom: 1px solid #4a6db0; cursor: move; touch-action: none;
}
.win > header button { width: 15px; height: 13px; line-height: 10px; padding: 0; font-size: 10px; border-radius: 3px; border: 1px solid #3f5f9f; background: linear-gradient(#fff, #c8d4ec); color: #3f5f9f; font-weight: 700; }
.rbtn, .actions button, .btn {
  font: 11px var(--font); padding: 1px 9px; min-height: 17px; border: 1px solid #8497bd; border-radius: 9px;
  background: linear-gradient(var(--btn-a), var(--btn-b)); color: #1e2a48; white-space: nowrap;
}
.rbtn:hover, .actions button:hover, .btn:hover { background: linear-gradient(#fff, #bfd0f0); }
.rbtn:active, .actions button:active { background: linear-gradient(#c3d2ee, #fff); }
.rbtn:disabled, .actions button:disabled { opacity: .45; cursor: default; }
.rbtn.attn, #menu button.attn { border-color: #d49a1a; box-shadow: 0 0 0 1px #f4c24a; color: #8a5a00; font-weight: 700; }
.actions button.main, .btn.main { background: linear-gradient(#8fb0ea, #4a72c0); color: #fff; border-color: #3a5a9a; }

.rbar { position: relative; height: 8px; background: #fff; border: 1px solid #8ea2c8; border-radius: 4px; overflow: hidden; }
.rbar i { position: absolute; inset: 0 auto 0 0; width: 0; transition: width .2s; }
.rbar.hp i { background: linear-gradient(#8fb4ff, var(--hp)); }
.rbar.hp.low i { background: linear-gradient(#ff9a90, var(--hp-low)); }
.rbar.sp i { background: linear-gradient(#8fb4ff, var(--sp)); }
.rbar.exp i { background: linear-gradient(#ffe38a, var(--exp)); }
.rbar.jexp i { background: linear-gradient(#aee89a, var(--jexp)); }

/* ── basic info ────────────────────────────────────── */
#basic { position: fixed; top: 6px; left: 6px; width: 262px; z-index: 12; }
.bi { display: grid; grid-template-columns: 1fr 58px; gap: 6px; padding: 5px 6px 6px; }
.bi-name { display: flex; flex-direction: column; margin-bottom: 3px; line-height: 1.25; }
.bi-name b { font-size: 12px; }
.bi-name span { color: var(--ink-soft); }
.bi-bar { display: grid; grid-template-columns: 18px 1fr; align-items: center; column-gap: 4px; }
.bi-bar label { font-weight: 700; font-size: 11px; }
.bi-bar span { grid-column: 2; text-align: right; font-size: 11px; line-height: 13px; }
.bi-lv { display: grid; grid-template-columns: 70px 1fr 38px; align-items: center; gap: 4px; margin-top: 2px; font-size: 11px; }
.bi-lv .rbar { height: 6px; }
.bi-lv em { font-style: normal; text-align: right; color: var(--ink-soft); font-size: 10px; }
.bi-zeny { margin-top: 3px; font-size: 11px; display: flex; align-items: center; gap: 3px; }
.bi-zeny .snd { margin-left: auto; display: flex; gap: 2px; }
.bi-zeny .snd .rbtn { padding: 0 5px; font-size: 10px; min-height: 15px; }
.bi-zeny .snd .rbtn.off { background: linear-gradient(#ffe4e0, #f4c0b8); color: #a02a1a; border-color: #c0392b; }
.bi-btns { display: flex; flex-direction: column; gap: 2px; }
.bi-btns .rbtn { width: 100%; padding: 0 2px; }

/* ── shortcut bar ──────────────────────────────────── */
#hotbar { position: fixed; top: 6px; left: 276px; display: flex; gap: 2px; padding: 3px; z-index: 11; }
.slot { position: relative; width: 34px; height: 34px; border-radius: 3px; background: linear-gradient(#fff, #e3eaf7); border: 1px solid var(--line-soft); display: grid; place-items: center; font-size: 19px; }
.slot .key { position: absolute; top: 0; left: 2px; font-size: 9px; color: #7a86a3; font-weight: 700; }
.slot .qty { position: absolute; bottom: 0; right: 2px; font-size: 10px; font-weight: 700; text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
.slot .cd { position: absolute; inset: 0; background: rgba(20, 30, 60, .45); border-radius: 3px; transform-origin: bottom; }
.slot.armed { box-shadow: 0 0 0 2px #f4c24a; }
.slot .sk { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }

/* ── target / minimap / party ──────────────────────── */
#target { position: fixed; top: 50px; left: 50%; transform: translateX(-50%); min-width: 200px; padding: 4px 10px 6px; text-align: center; z-index: 10; }
#target .rbar { margin-top: 3px; }
#mapbox { position: fixed; top: 6px; right: 6px; z-index: 10; }
#minimap { width: 144px; height: 144px; display: block; image-rendering: pixelated; border-top: 1px solid var(--line); }
#party-hud { position: fixed; top: 176px; right: 6px; width: 146px; padding: 4px 6px; font-size: 11px; z-index: 10; }
#party-hud .pm { margin: 3px 0; }
#party-hud .rbar { height: 5px; }

/* ── chat ──────────────────────────────────────────── */
#chat { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; pointer-events: none; }
.chat-tabs button, #chat-new, #chat-mode, #chat-size { pointer-events: auto; }
#chat-log { width: min(560px, 100vw); height: 62px; margin-left: 6px; overflow-y: auto; padding: 3px 6px; font-size: 12px; line-height: 1.35;
  background: rgba(10, 16, 30, .42); color: #fff; text-shadow: 0 1px 1px #000; border-radius: 3px 3px 0 0; pointer-events: auto; -webkit-user-select: text; user-select: text; }
#chat-log .sys { color: #ffe27a; }
#chat-log .party { color: #9cf07a; }
#chat-log .say b { color: #bfe0ff; }
#chat-log .world { color: #ffd9a0; }
#chat-log .world b { color: #ffb84d; }
#chat-log .pm { color: #f0b8ff; }
#chat-log .pm b { color: #e98cff; }
#chat-log .pm-ar { font-style: normal; opacity: .75; margin-right: 2px; }
.chat-bar { display: flex; align-items: center; height: 20px; background: linear-gradient(#f4f7fd, #d9e2f3); border-top: 1px solid var(--line); pointer-events: auto; }
.chat-bar span { width: 18px; text-align: center; color: #4a72c0; font-weight: 700; }
#chat-in { flex: 1; height: 16px; font: 12px var(--font); border: 1px solid var(--line-soft); padding: 0 5px; margin-right: 4px; }

#menu { display: none; }

/* ── windows ───────────────────────────────────────── */
.win { position: fixed; z-index: 20; width: 290px; max-width: calc(100vw - 12px); max-height: calc(100vh - 150px); display: flex; flex-direction: column; }
.win .body { padding: 6px 7px 7px; overflow-y: auto; }
.win .foot { display: flex; justify-content: space-between; align-items: center; padding: 4px 7px; border-top: 1px solid var(--line-soft); background: var(--panel-2); border-radius: 0 0 4px 4px; }

/* status */
.st-grid { display: grid; grid-template-columns: 1.25fr 1fr 1fr; border: 1px solid var(--line-soft); background: #fff; }
.st-col { padding: 2px 4px; }
.st-col + .st-col { border-left: 1px solid var(--line-soft); }
.st-row { display: flex; align-items: center; justify-content: space-between; height: 19px; gap: 3px; }
.st-row b { width: 24px; }
.st-row .v { flex: 1; text-align: right; }
.st-row .bonus { color: #2f7a2a; }
.st-row .up { width: 15px; height: 13px; padding: 0; line-height: 10px; font-size: 8px; border: 1px solid #8497bd; border-radius: 3px; background: linear-gradient(#fff, #d7e0f1); color: #3f5f9f; }
.st-row .up:disabled { opacity: .3; }
.st-row .cost { width: 12px; text-align: right; color: var(--ink-soft); font-size: 10px; }
.st-row.pts { color: #c0392b; font-weight: 700; }

/* items */
.inv { display: grid; grid-template-columns: 20px 1fr; gap: 4px; }
.vtabs { display: flex; flex-direction: column; gap: 2px; }
.vtabs button { writing-mode: vertical-rl; transform: rotate(180deg); font: 10px var(--font); padding: 5px 0; border: 1px solid var(--line); border-radius: 3px; background: linear-gradient(90deg, #fff, #d7e0f1); color: #3f5f9f; }
.vtabs button.on { background: linear-gradient(90deg, #8fb0ea, #4a72c0); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, 34px); gap: 3px; align-content: start; min-height: 110px; padding: 3px; background: #fff; border: 1px solid var(--line-soft); }
.grid .slot.sel { box-shadow: 0 0 0 2px #4a72c0; }
.grid .slot .eq { position: absolute; top: 0; right: 2px; font-size: 9px; color: #c0392b; font-weight: 700; }
.detail { margin-top: 5px; padding: 5px 6px; background: #fff; border: 1px solid var(--line-soft); font-size: 11px; line-height: 1.45; }
.detail h4 { margin: 0 0 3px; font-size: 12px; }
.actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }

/* equipment */
.eqw { display: grid; grid-template-columns: 1fr 112px 1fr; gap: 4px; align-items: stretch; }
.eqcol { display: flex; flex-direction: column; gap: 3px; }
.eqslot { display: flex; align-items: center; gap: 3px; min-height: 30px; padding: 1px 3px; background: #fff; border: 1px solid var(--line-soft); border-radius: 3px; font-size: 10px; line-height: 1.15; text-align: left; cursor: pointer; }
.eqcol.r .eqslot { flex-direction: row-reverse; text-align: right; }
/* แถวช่องแฟชั่นใต้ตัวละคร — เต็มความกว้าง 5 ช่อง */
.eqcos { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; margin-top: 2px; }
.eqcos .eqcos-label { grid-column: 1 / -1; color: #7a6a9a; }
.eqcos .eqslot { min-height: 26px; }
.eqslot .ic { font-size: 16px; width: 20px; text-align: center; }
.eqslot.empty { color: #9aa6c2; cursor: default; background: linear-gradient(#fbfcff, #eef2fa); border-style: dashed; }
.eqslot:not(.empty):hover { border-color: #4a72c0; }
.preview { position: relative; border: 1px solid var(--line-soft); background: radial-gradient(circle at 50% 70%, #fff 0, #dfe8f7 70%); border-radius: 3px; overflow: hidden; }
.preview canvas { width: 100%; height: 100%; display: block; }

/* skills */
.sk-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 6px; align-items: center; padding: 3px 2px; border-bottom: 1px solid var(--line-soft); }
.sk-row:hover { background: #eef3fc; }
.sk-row .ic { width: 28px; height: 28px; border-radius: 4px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 10px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.sk-row .nm { font-weight: 700; }
.sk-row .lv { display: flex; justify-content: space-between; color: var(--ink-soft); font-size: 11px; }
.sk-row p { margin: 1px 0 0; font-size: 10px; color: var(--ink-soft); }
.sk-list { background: #fff; border: 1px solid var(--line-soft); }

/* shop / npc / party */
.shop-row { display: grid; grid-template-columns: 24px 1fr auto auto; gap: 5px; align-items: center; padding: 2px 3px; border-bottom: 1px solid var(--line-soft); background: #fff; }
.npc-text { background: #fff; border: 1px solid var(--line-soft); padding: 6px 8px; line-height: 1.5; margin-bottom: 5px; }
.pt-row { display: grid; grid-template-columns: 1fr auto; padding: 3px 4px; border-bottom: 1px solid var(--line-soft); background: #fff; }
.el { display: inline-block; padding: 0 5px; border-radius: 3px; color: #fff; font-size: 10px; font-weight: 700; }
.win input { font: 12px var(--font); padding: 2px 5px; border: 1px solid var(--line); border-radius: 2px; }
.dlg { min-width: 240px; }
.dlg .body { padding: 10px; text-align: center; }

/* ── world labels & floating text ──────────────────── */
.label { pointer-events: none; text-align: center; font: 700 11px var(--font); color: #fff; text-shadow: -1px 0 #000, 1px 0 #000, 0 -1px #000, 0 1px #000; white-space: nowrap; }
.label.npc { color: #9fd8ff; }
/* ❗/❓ เหนือหัว NPC (main.js questMark) — สไตล์เดียวกับ ! ของบทสอน (ui-tutorial.css .tut-mark) */
.label .qmark { display: grid; place-items: center; width: 30px; height: 30px; margin: 0 auto 3px; border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #fffaf0, #f6e0a8); border: 2px solid #e8b64a; box-shadow: 0 3px 8px rgba(60, 40, 10, .35);
  font: 900 22px/1 var(--font-head, inherit); color: #d9901a; text-shadow: none; -webkit-text-stroke: 1px #6b4510; animation: qmarkBob 1.1s ease-in-out infinite; }
.label .qmark.turn { background: radial-gradient(circle at 50% 38%, #fff6c8, #f2c94a); color: #fffaf0; -webkit-text-stroke: 1.5px #6b4510; }
.label .qmark.wait { width: auto; min-width: 30px; height: auto; padding: 2px 6px; border-radius: 12px; background: #ece6d8; border-color: #b8ad98;
  color: #8a8070; -webkit-text-stroke: 0; font-size: 18px; animation: none; }
.label .qmark.side { background: radial-gradient(circle at 50% 38%, #c8f0e8, #3f9a92); border-color: #1f5a56; color: #fffaf0; -webkit-text-stroke: 1.5px #173f3c; }   /* เรื่องข้างทาง (teal) */
.label .qmark.side.turn { background: radial-gradient(circle at 50% 38%, #e6fffa, #5cc0b4); }
.label .qmark.side.wait { background: #e2ece9; border-color: #9fb8b3; color: #2f6f73; -webkit-text-stroke: 0; }
.label .qmark small { display: block; font: 800 11px/1.1 var(--font); color: #6b6050; }
@keyframes qmarkBob { 50% { transform: translateY(-5px); } }
.label.party { color: #9cf07a; }
.label .mini { width: 44px; height: 5px; margin: 2px auto 0; background: #1a2240; border: 1px solid #000; overflow: hidden; }
.label .mini i { display: block; height: 100%; background: #4cd04a; }
.label .mini.sp i { background: #4a8aff; }
.label .castbar { width: 58px; height: 6px; margin: 2px auto; background: #1a2240; border: 1px solid #000; overflow: hidden; }
.label .castbar i { display: block; height: 100%; background: #ffd23a; width: 0; }
.bubble { background: #fff; color: #222; text-shadow: none; font-weight: 400; padding: 2px 7px; border: 1px solid #7f95c4; border-radius: 3px; margin-bottom: 3px; max-width: 220px; white-space: normal; }
.dmg { pointer-events: none; font: 900 22px Verdana, var(--font); color: #fff; -webkit-text-stroke: 1px #000; text-shadow: 0 2px 0 #000; animation: rise 1s ease-out forwards; white-space: nowrap; }
.dmg.me { color: #ff4a3a; }
.dmg.crit { position: relative; color: #ffe23a; font-size: 30px; padding: 10px 14px; }
.dmg.crit::before { content: ''; position: absolute; inset: -6px -10px; z-index: -1; background: radial-gradient(circle, #ff5a2a 0 35%, #d8201a 36% 60%, transparent 61%);
  clip-path: polygon(50% 0, 60% 30%, 92% 10%, 72% 42%, 100% 50%, 72% 60%, 92% 90%, 60% 70%, 50% 100%, 40% 70%, 8% 90%, 28% 60%, 0 50%, 28% 42%, 8% 10%, 40% 30%);
  animation: burst .35s ease-out; }
.dmg.crit small.tag { font-size: 10px; color: #fff; letter-spacing: 1px; }
/* คริเวทมนตร์: เลขฟ้าบนวงน้ำเงิน — อ่านปราดเดียวว่าดาเมจก้อนนี้มาจากสาย INT ไม่ใช่กำลังอาวุธ */
.dmg.crit.mcrit { color: #d8f2ff; }
.dmg.crit.mcrit::before { background: radial-gradient(circle, #4aa8ff 0 35%, #1a56d8 36% 60%, transparent 61%); }
@keyframes burst { from { transform: scale(.2) rotate(-20deg); } to { transform: scale(1) rotate(0); } }
.dmg.miss { color: #d8e0f0; font-size: 14px; -webkit-text-stroke: 0; text-shadow: -1px 0 #000, 1px 0 #000, 0 -1px #000, 0 1px #000; }
.dmg.heal { color: #6cf06a; }
/* Mana Shield (3 ต.ค.): ครั้งที่เหลือเหนือหัว — โล่น้ำเงินทึบขอบทอง ตัวเลขขาว อ่านออกบนหญ้า/ทราย · เลขเปลี่ยน = เด้ง */
.label.wardtag { pointer-events: none; }
.wardtag-n { display: inline-grid; place-items: center; min-width: 22px; height: 24px; padding: 0 3px; box-sizing: border-box;
  background: #2a5ac8; color: #fff; border: 2px solid #e8b64a; border-radius: 6px 6px 50% 50% / 6px 6px 45% 45%;
  font: 900 14px/1 Verdana, var(--font); -webkit-text-stroke: .5px #0d2050; box-shadow: 0 1px 2px rgba(0,0,0,.5); animation: wardPop .25s ease-out; }
@keyframes wardPop { from { transform: scale(1.5); } to { transform: scale(1); } }
.dmg.emote { color: #fff3d6; font-size: 18px; -webkit-text-stroke: 0; text-shadow: -1px 0 #7a4a1a, 1px 0 #7a4a1a, 0 -1px #7a4a1a, 0 1px #7a4a1a; }   /* พุดดิ้งโดนตี: 💦 ><; */
.dmg.sp { color: #6aa8ff; }
.dmg small { font-size: 11px; display: block; -webkit-text-stroke: 0; text-shadow: -1px 0 #000, 1px 0 #000, 0 -1px #000, 0 1px #000; }
.dmg.big { font-size: 28px; color: #ffe27a; }
@keyframes rise { 0% { transform: translateY(0) scale(1.5); opacity: 1; } 12% { transform: translateY(-14px) scale(1); } 25% { transform: translateY(-6px); } 100% { transform: translateY(-58px); opacity: 0; } }
/* A4 ตัวเลขดาเมจแบบการ์ตูน: พองโตเกินแล้วหดเด้ง · ลอยเฉียงตาม --dx · คริใหญ่กว่าและสั่นนิด ๆ ตอนเกิด */
@keyframes dmgPop { 0% { transform: translate(0, 4px) scale(0.35); opacity: 0; } 14% { transform: translate(calc(var(--dx, 0px) * 0.3), -12px) scale(1.45); opacity: 1; }
  26% { transform: translate(calc(var(--dx, 0px) * 0.45), -10px) scale(0.92); } 36% { transform: translate(calc(var(--dx, 0px) * 0.55), -14px) scale(1.05); }
  72% { opacity: 1; } 100% { transform: translate(var(--dx, 0px), -56px) scale(0.95); opacity: 0; } }
@keyframes dmgCrit { 0% { transform: scale(0.3) rotate(-8deg); opacity: 0; } 12% { transform: translate(calc(var(--dx, 0px) * 0.2), -14px) scale(1.7) rotate(4deg); opacity: 1; }
  20% { transform: translate(calc(var(--dx, 0px) * 0.3), -12px) scale(1.1) rotate(-3deg); } 28% { transform: translate(calc(var(--dx, 0px) * 0.4), -16px) scale(1.22) rotate(1deg); }
  75% { opacity: 1; } 100% { transform: translate(var(--dx, 0px), -64px) scale(1); opacity: 0; } }
/* คริใช้ท่าเดิม (rise + วงแดง) — ท่า dmgCrit แบบใหม่ ผู้ใช้ว่าทรงไม่สวย ของเดิมดีกว่า (26 ก.ย.) */
.dmg:not(.miss):not(.emote):not(.heal):not(.crit) { animation-name: dmgPop; }
@media (prefers-reduced-motion: reduce) { .dmg { animation-name: rise !important; } }
#toast { position: fixed; top: 24%; left: 50%; transform: translateX(-50%); font: 900 28px Verdana, var(--font); color: #ffe27a; -webkit-text-stroke: 1px #6a4a00; text-shadow: 0 3px 0 #000; pointer-events: none; z-index: 40; opacity: 0; transition: opacity .3s; text-align: center; }
#toast.show { opacity: 1; }

/* ── phone ─────────────────────────────────────────── */
@media (max-width: 760px) {
  html, body { font-size: 13px; }
  #basic { width: 190px; }
  .bi { grid-template-columns: 1fr; }
  .bi-btns { display: none; }
  #hotbar { top: auto; bottom: 8px; left: 6px; flex-wrap: wrap; width: 190px; }
  .slot { width: 36px; height: 36px; }
  #mapbox canvas { width: 96px; height: 96px; }
  #party-hud { top: 130px; }
  #chat-log { width: calc(100vw - 12px); height: 64px; }
  #chat { bottom: 92px; }
  #menu { display: grid; position: fixed; right: 6px; bottom: 8px; grid-template-columns: repeat(4, 42px); gap: 3px; z-index: 11; }
  #menu button { height: 40px; border-radius: 6px; border: 1px solid var(--line); background: linear-gradient(#fff, #d7e0f1); font-size: 17px; display: grid; place-items: center; line-height: 1; padding: 1px; }
  #menu small { font-size: 8px; color: var(--ink-soft); }
  .win { left: 6px !important; right: 6px; top: 150px !important; width: auto; max-height: calc(100vh - 260px); }
  #target { top: auto; bottom: 190px; }
}

.ic3d { width: 30px; height: 30px; display: block; pointer-events: none; }
.eqslot .ic .ic3d, .shop-row .ic3d { width: 22px; height: 22px; }
.detail h4 .ic3d { display: inline-block; width: 22px; height: 22px; vertical-align: middle; }

#hotbar .hb-page { width: 16px; display: flex; align-items: center; justify-content: center; font: bold 11px sans-serif; color: #fff; background: #5a6f9e; border-radius: 3px; cursor: pointer; user-select: none; }
#hotbar .hb-page:hover { background: #7f95c4; }
.sk-head { font-weight: bold; color: #2f4f86; border-bottom: 1px solid #b8c4dc; margin: 6px 0 2px; padding-bottom: 1px; font-size: 12px; }

.fps { font: 500 11px/1 ui-monospace, monospace; color: #3f63a8; margin-left: 4px; }
.rbtn.off { opacity: .55; }

/* chat */
.chat-tabs { display: flex; gap: 3px; align-items: center; padding: 2px 4px 0; width: min(560px, 100vw); margin-left: 6px; }
.chat-tabs button { font: 500 11px/1 inherit; padding: 3px 8px; border: 1px solid var(--line); border-bottom: 0; border-radius: 4px 4px 0 0; background: linear-gradient(var(--btn-a), var(--btn-b)); color: var(--ink); cursor: pointer; }
.chat-tabs button.on { background: linear-gradient(#7ea3e4, #4a72c0); color: #fff; border-color: #3a5a9a; }
.chat-tabs .grow { flex: 1; }
#chat-log b.who { cursor: pointer; text-decoration: underline dotted; }
#chat-log b.who:hover { color: #2f4f86; }
#chat-new { position: absolute; right: 8px; bottom: 30px; font: 500 11px/1 inherit; padding: 4px 9px; border-radius: 10px; border: 1px solid #3a5a9a; background: #4a72c0; color: #fff; cursor: pointer; z-index: 3; }
#chat-mode { font: 500 11px/1 inherit; padding: 3px 8px; margin-right: 4px; border: 1px solid var(--line); border-radius: 4px; background: linear-gradient(var(--btn-a), var(--btn-b)); color: var(--ink); cursor: pointer; white-space: nowrap; }
#chat-mode[data-ch="party"] { background: linear-gradient(#8ad0a0, #4aa86a); color: #fff; border-color: #3a8a56; }
#chat-mode[data-ch="world"] { background: linear-gradient(#f5c877, #d8912f); color: #4a2d00; border-color: #a96c17; }
#chat-mode[data-ch="pm"] { background: linear-gradient(#d9a0ea, #a558c4); color: #fff; border-color: #8a3fa8; }
/* ตัวเลือกช่องแชท — ลอยเหนือแถบพิมพ์ กดทีเดียวเลือกได้ ไม่ต้องกดวนทีละช่อง */
#chat-ch { position: absolute; left: 6px; bottom: 100%; margin-bottom: 4px; z-index: 6; pointer-events: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 4px; min-width: 190px;
  background: linear-gradient(#f8fbff, #e4ecf8); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px #00000055; }
#chat-ch button { display: flex; align-items: center; gap: 7px; width: 100%; font: 500 12px/1.2 inherit; text-align: left;
  padding: 7px 9px; border: 0; border-radius: 4px; background: transparent; color: var(--ink); cursor: pointer; }
#chat-ch button:hover { background: #d3e0f5; }
#chat-ch button.on { background: linear-gradient(#7ea3e4, #4a72c0); color: #fff; }
#chat-ch small { margin-left: auto; opacity: .7; font-size: 10px; }
#chat-ch button.on small { opacity: .85; }
.ch-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #bfe0ff; }
.ch-dot.world { background: #ffb84d; } .ch-dot.party { background: #6fd28c; } .ch-dot.pm { background: #e98cff; }
/* เมนูที่โผล่ตอนกดชื่อคน */
.ctx { position: fixed; z-index: 60; display: flex; flex-direction: column; min-width: 160px; padding: 5px;
  background: linear-gradient(#f8fbff, #e4ecf8); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 22px #00000066; }
.ctx > b { padding: 4px 8px 6px; font-size: 12px; color: #2f4f86; border-bottom: 1px solid var(--line-soft); margin-bottom: 3px; }
.ctx button { font: 500 12px/1.2 inherit; text-align: left; padding: 8px 9px; border: 0; border-radius: 4px; background: transparent; color: var(--ink); cursor: pointer; }
.ctx button:hover { background: #d3e0f5; }
/* หน้าต่างผู้เล่น & ห้องคุย */
.soc-tabs { display: flex; gap: 3px; margin-bottom: 5px; }
.soc-tabs button { flex: 1; font: 500 11px/1 inherit; padding: 6px 4px; border: 1px solid var(--line); border-radius: 4px; background: linear-gradient(var(--btn-a), var(--btn-b)); color: var(--ink); cursor: pointer; }
.soc-tabs button.on { background: linear-gradient(#7ea3e4, #4a72c0); color: #fff; border-color: #3a5a9a; }
.soc-row { display: flex; align-items: center; gap: 6px; padding: 5px 4px; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.soc-row > span:first-child { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.soc-row small { opacity: .72; font-size: 10px; }
.soc-act { display: flex; gap: 4px; flex: none; }
.soc-act button { font: 500 11px/1 inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: linear-gradient(var(--btn-a), var(--btn-b)); color: var(--ink); cursor: pointer; }
#chat.big #chat-log { height: 200px; }
#party-hud .pm { margin: 4px 0; padding: 2px 4px; border-radius: 4px; cursor: pointer; }
#party-hud .pm:hover { background: #e8eefb; }
#party-hud .pm.on { background: #dff0e4; box-shadow: inset 0 0 0 1px #4aa86a; }
#party-hud .pm.dead { opacity: .55; }
#party-hud .pm-top { display: flex; gap: 4px; justify-content: space-between; }
#party-hud .rbar.sp { height: 3px; margin-top: 1px; }


/* ── เป้าหมายตอนนี้ ─────────────────────────────────
   เกมไม่มีเควส ผู้เล่นใหม่จึงไม่รู้ว่าต้องทำอะไรต่อ กล่องนี้ตอบคำถามนั้นข้อเดียว */
#goal { position: fixed; left: 6px; top: 200px; width: 252px; z-index: 8; }
#goal .body { padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
#goal b { font: 700 13px/1.35 inherit; color: #23406f; }
#goal small { font: 400 11px/1.35 inherit; color: #5c6b84; }
#goal.pulse { animation: goalPulse 1.2s ease-out; }
@keyframes goalPulse { 0% { box-shadow: 0 0 0 0 rgba(232, 182, 74, .9); } 100% { box-shadow: 0 0 0 10px rgba(232, 182, 74, 0); } }
/* แตะการ์ด = ทำเป้าหมายให้เลย (เดินไปเอง/เปิดหน้าต่าง) — ต้องดูออกว่ากดได้ ไม่ใช่ป้ายอ่านอย่างเดียว */
#goal.tap { cursor: pointer; }
#goal.tap:hover { filter: brightness(1.04); }
#goal.tap:active { transform: translateY(1px); }
#goal header { display: flex; align-items: center; }
#goal header em { margin-left: auto; font: 700 11px/1 var(--font-head, inherit); font-style: normal; color: #fff; background: #d9862a; border-radius: 999px; padding: 3px 7px; white-space: nowrap; }
#goal header em[hidden] { display: none; }
/* แถวล่าง: เควสวันนี้ (นับ) + 📯 ขอความช่วยเหลือ — สองปุ่มที่คนใหม่ต้องเจอโดยไม่ต้องรู้คำสั่ง /quest /sos */
#goal .gfoot { display: flex; gap: 4px; padding: 0 6px 6px; }
#goal .gfoot button { flex: 1; min-height: 26px; padding: 2px 6px; font: 700 11.5px/1.2 inherit; color: #3b3320; background: linear-gradient(#fff9ea, #f1e4c4); border: 1px solid #c9ad72; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#goal .gfoot button:hover { filter: brightness(1.05); }
#goal .gfoot #goal-sos { flex: 0 0 auto; }
#goal .gfoot #goal-quest.done { color: #2c6b3c; }
/* ปุ่ม "ไปหา" ในบรรทัด 📯 ของแชท */
#chat-log .sys-go { margin-left: 6px; padding: 1px 8px; font: 700 11px/1.4 inherit; color: #1e1a10; background: #ffd76a; border: 1px solid #b98a1e; border-radius: 999px; cursor: pointer; }
#chat-log .sys-go:hover { background: #ffe89a; }
/* แถบพิธีฟังระฆัง (ceremony-bar.js) — คอม: กลางบนใต้หลอดบอส · จอสัมผัส: โซน tc (ui-touch.css) */
#cer-bar { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); width: min(440px, 70vw); z-index: 19; cursor: pointer;   /* คอม: ต่ำกว่าหน้าต่าง (.win เริ่ม 21) — เดิม 30 ลอยทับทุกบาน */
  padding: 6px 10px 7px; border-radius: 12px; background: rgba(31, 52, 50, .82); border: 1.5px solid #3f9a92; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
#cer-bar .cb-top { display: flex; align-items: baseline; gap: 8px; color: #fffaf0; font-size: 14px; text-shadow: 0 1px 2px #10201e; }
#cer-bar .cb-top b { font-weight: 800; }
#cer-bar .cb-top span { margin-left: auto; font-size: 12px; font-weight: 700; color: #cfeee8; }
#cer-bar .cb-track { margin-top: 4px; height: 9px; border-radius: 6px; background: #17302e; border: 1.5px solid #e8b64a; overflow: hidden; }
#cer-bar .cb-track i { display: block; height: 100%; width: 0; background: linear-gradient(#ffe7a0, #e8b64a); transition: width .6s ease-out; }
#cer-bar .cb-sub { display: block; margin-top: 4px; font-size: 11px; line-height: 1.35; color: #d9ece8; }
#cer-bar:not(.live) .cb-track { display: none; }
#cer-bar.done { border-color: #e8b64a; }
#cer-bar .cb-go { display: none; }
#cer-bar .cb-x { position: absolute; top: 2px; right: 4px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #cfeee8; font: 700 16px/1 inherit; cursor: pointer; }
#cer-bar .cb-x:hover { background: rgba(255, 255, 255, .12); }
#cer-bar { padding-right: 28px; }
/* ป้าย "กำลังตาม X [หยุด]" (follow.js · 4 ต.ค.) — คอม: กลางล่างเหนือช่องลัด (กลางบนมีหลอดบอส/ป้ายมอน/แถบระฆังแล้ว) · จอสัมผัส: โซน tc (ui-root.js) */
#follow-badge { position: fixed; left: 50%; bottom: 112px; transform: translateX(-50%); z-index: 160;   /* คอม: เหนือหน้าต่าง (ui.js bumpZ วนไม่เกิน ~152) — ป้ายต้องเห็นตลอด · จอสัมผัสใช้ชั้น HUD ของโซน */
  display: flex; align-items: center; gap: 8px;
  padding: 4px 5px 4px 10px; border-radius: 999px; background: rgba(31, 52, 50, .86); border: 1.5px solid #e8b64a; box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  color: #fffaf0; font-size: 13px; white-space: nowrap; max-width: calc(100vw - 32px); }
#follow-badge[hidden] { display: none; }
#follow-badge .fb-ico { font-size: 15px; }
#follow-badge .fb-txt { overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #10201e; }
#follow-badge .fb-txt b { color: #ffe7a0; }
#follow-badge .fb-txt em { font-style: normal; margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: #2f6f73; color: #dff5f2; font-size: 11px; font-weight: 700; }
#follow-badge button { flex: none; min-height: 28px; padding: 3px 12px; border: 0; border-radius: 999px; background: #e8b64a; color: #2b2010; font: 800 12.5px/1 inherit; cursor: pointer; }
#follow-badge button:hover { background: #ffd36e; }
html.touch-ui #follow-badge { font-size: 12px; max-width: 100%; box-sizing: border-box; }
html.touch-ui #follow-badge button { min-height: 32px; min-width: 52px; }
/* บรรทัดเดียว: ก่อนเริ่ม 5 นาที / มีพิธีแต่อยู่ไกล — ไม่มีแถบ ไม่มีรายละเอียด แตะ = เดินไป */
#cer-bar.mini .cb-track, #cer-bar.mini .cb-sub, #cer-bar.mini .cb-go { display: none !important; }
#cer-bar.mini { padding-top: 5px; padding-bottom: 5px; }
/* จอสัมผัส: ย่อบรรทัดเดียว (ไม่บังตัวละครกลางจอ) · แตะกาง = รางวัล+อัตรา+ปุ่มเดินไปลาน */
html.touch-ui #cer-bar:not(.open) .cb-rew { display: none; }
html.touch-ui #cer-bar:not(.open) .cb-sub::after { content: ' · ' attr(data-more); }
html.touch-ui #cer-bar .cb-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.touch-ui #cer-bar.open .cb-sub { white-space: normal; }
html.touch-ui #cer-bar.open .cb-go { display: inline-block; margin-top: 5px; padding: 3px 12px; border-radius: 999px; border: 1px solid #e8b64a; background: #2f6f73; color: #fffaf0; font: 700 12px/1.4 inherit; }
/* การ์ดรางวัลพิธี (ceremony-fx.js · ใช้โครง .bf-reward/.bfr-card ของหอระฆัง) — ของหายาก: กรอบทองเรือง + บรรทัดเด่น */
#cer-reward .bfr-card.cer-rare { box-shadow: 0 0 0 3px #e8b64a, 0 0 28px 6px rgba(232, 182, 74, .55); animation: cerRareGlow 1.6s ease-in-out infinite; }
#cer-reward .cer-li-rare { background: linear-gradient(#fff4cf, #ffe39a) !important; border-color: #e8b64a !important; font-weight: 800 !important; color: #6b4510; }
@keyframes cerRareGlow { 50% { box-shadow: 0 0 0 3px #f2c94a, 0 0 40px 10px rgba(232, 182, 74, .7); } }
/* หน้าต่างเควสวันนี้ */
.qd-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 8px; }   /* 4 แท็บ: เนื้อเรื่อง · ข้างทาง · ค่าหัว · วันนี้ */
.qd-tab { position: relative; padding: 6px 2px; font: 700 12.5px/1.2 inherit; color: #7a6548; background: #f3ead6; border: 1px solid #e0cfa8; border-radius: 10px; }
.qd-tab.on { color: #fffaf0; background: #2f6f73; border-color: #1f5a56; }
.qd-tab i { margin-left: 4px; padding: 0 5px; font-style: normal; font-size: 10.5px; border-radius: 8px; background: rgba(232, 182, 74, .9); color: #3a2a0c; }
.qd-lv { font-size: 11.5px; font-weight: 700; color: #9a8466; }
.qd-where { margin-top: 2px; font-size: 12px; color: #5d4a30; line-height: 1.35; }
.qd-where.dim { color: #9a8466; font-size: 11.5px; }
.qd-sub { font-size: 12.5px; color: #6b4a14; }
.qd-mob { border-radius: 50%; background: #efe4c8; }
.qd-card.side .qd-chk { border-color: #3f9a92; color: #2f6f73; font-size: 13px; }
.qd-card.side.done .qd-chk { background: #3f9a92; color: #fff; }
.qd-card.wait { opacity: .7; }
.qd-list { display: flex; flex-direction: column; gap: 6px; }
.qd-card { display: grid; grid-template-columns: 24px 36px 1fr; gap: 8px; align-items: center; padding: 7px 10px;
  background: #fffaf0; border: 1px solid #e6d7b6; border-radius: 12px; box-shadow: 0 1px 0 #fff inset, 0 2px 4px rgba(90, 64, 30, .08); }
.qd-chk { width: 22px; height: 22px; border-radius: 7px; border: 2px solid #cdbf9e; background: #fff; display: grid; place-items: center;
  color: #fff; font-weight: 900; font-size: 14px; line-height: 1; }
.qd-card.done .qd-chk { background: #4caf5c; border-color: #3d9a4d; }
.qd-ic { width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(60, 40, 10, .25)); }
.qd-main { min-width: 0; }
.qd-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.qd-top b { font-weight: 700; font-size: 13.5px; color: #4a3520; line-height: 1.3; }
.qd-top small { flex: none; font-size: 13px; font-weight: 700; color: #7a6548; font-variant-numeric: tabular-nums; }
.qd-card.done .qd-top small { color: #3d9a4d; }
.qd-bar { margin-top: 5px; height: 7px; border-radius: 4px; background: #ece3cf; overflow: hidden; }
.qd-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(#8fd07a, #5cb65a); }
.qd-card.done .qd-bar i { background: linear-gradient(#6cc36c, #3d9a4d); }
.qd-reward { margin-top: 8px; padding: 8px 10px; border-radius: 12px; border: 1.5px solid #e8b64a;
  background: linear-gradient(#fff6db, #fde9b8); box-shadow: 0 0 12px rgba(232, 182, 74, .35); }
.qd-reward.done { border-color: #4caf5c; background: linear-gradient(#f1faea, #dff1d2); box-shadow: 0 0 10px rgba(76, 175, 92, .25); }
.qd-rh { font-size: 14px; font-weight: 800; color: #6b4a14; margin-bottom: 6px; }
.qd-reward.done .qd-rh { color: #2f7a3c; }
.qd-items { display: flex; gap: 8px; }
.qd-it { flex: 1; display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center;
  padding: 5px 8px; background: rgba(255, 255, 255, .7); border: 1px solid #efd9a2; border-radius: 10px; }
.qd-it img { grid-row: 1 / 3; width: 36px; height: 36px; object-fit: contain; }
.qd-it b { font-size: 13px; color: #4a3520; line-height: 1.2; }
.qd-it small { font-size: 13px; color: #7a6548; font-weight: 700; }
.qd-note { margin: 5px 2px 0; font-size: 13px; color: #7a6548; line-height: 1.45; }

/* ── จอสัมผัส: ทุกอย่างที่กดได้ต้องไม่เล็กกว่า 44px ──
   เกณฑ์ของ Apple · ปุ่มจิ๋วบนมือถือคือสัญญาณแรกที่รีวิวเวอร์เห็นว่า "นี่คือเว็บที่ถูกห่อมา" */
@media (pointer: coarse) {
  button, .rbtn, .slot, .chat-tabs button { min-height: 44px; min-width: 44px; }
  #hotbar .slot { width: 46px; height: 46px; }
  .chat-tabs button { padding: 0 12px; }
  #menu button { min-width: 56px; }
  .st-up { width: 30px; height: 30px; }          /* ปุ่ม ▲ แจกสเตตัส อยู่ในตาราง ขยายได้เท่าที่ตารางให้ */
  #goal { top: 172px; bottom: auto; width: min(252px, 58vw); }   /* ใต้ Basic Info — ล่างจอเป็นที่ของจอยเสมือน */
  #mapbox header span { font-size: 11px; white-space: nowrap; }   /* ชื่อโซน+พิกัดยาวเกินจนตกบรรทัด */
}
/* ปุ่มส่งข้อความ — บนคอมใช้ Enter อยู่แล้ว ปุ่มนี้จึงโผล่เฉพาะจอสัมผัส (ดู ui-mobile.css) */
#chat-send { display: none; }

/* ── บรรทัดแชท ────────────────────────────────────────────────────────
   อ่านง่ายขึ้นด้วยการ "แยกส่วน" ให้ตาไล่ได้: เวลา → ป้ายช่อง → ชื่อ → ข้อความ
   ไม่ใช่ตัวหนังสือสียาวพรืดบรรทัดเดียวแบบเดิม · ชื่อกับข้อความคนละน้ำหนัก
   ป้ายช่องเป็นสีประจำช่อง ทำให้กวาดตาหาเฉพาะช่องที่สนใจได้โดยไม่ต้องอ่านทุกบรรทัด */
#chat-log .ln { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px;
  padding: 2px 4px; border-radius: 4px; }
#chat-log .ln + .ln { margin-top: 1px; }
#chat-log .ln:hover { background: #ffffff14; }
#chat-log time { flex: none; font-size: 10px; opacity: .45; font-variant-numeric: tabular-nums; }
#chat-log .tag { flex: none; font-style: normal; font-size: 9px; font-weight: 700; line-height: 1;
  padding: 2px 5px; border-radius: 999px; color: #1b2436; background: #bfe0ff; }
#chat-log .world .tag { background: #ffc46a; }
#chat-log .party .tag { background: #8fe0a6; }
#chat-log .pm .tag { background: #e9a8ff; }
#chat-log .who { flex: none; font-weight: 700; }
#chat-log .sep { opacity: .5; margin-left: -3px; }
#chat-log .msg { flex: 1 1 60%; min-width: 0; overflow-wrap: anywhere; color: #f2f6ff; }
#chat-log .sys .msg { color: #ffe27a; font-style: italic; }
#chat-log .world .msg { color: #ffe9cc; }
#chat-log .party .msg { color: #d9f6e2; }
#chat-log .pm .msg { color: #f8ddff; }

/* ── ปุ่มซูม/กางแผนที่ บนมินิแมพ ───────────────────────────────────── */
#mapbox { position: fixed; }
.map-btns { position: absolute; left: 4px; bottom: 4px; display: flex; gap: 3px; z-index: 2; }
.map-btns button { width: 22px; height: 22px; padding: 0; font: 700 13px/1 system-ui; border: 1px solid var(--line);
  border-radius: 5px; background: #ffffffd9; color: #2f4f86; cursor: pointer; }
.map-btns button:disabled { opacity: .35; cursor: default; }

/* ── แผนที่เต็มจอ — แตะจุดไหนก็เดินไปจุดนั้น ───────────────────────── */
#bigmap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: #0b1524cc; backdrop-filter: blur(2px);
  /* viewport-fit=cover: หัวแผนที่ (ปุ่ม ✕) ต้องพ้นแถบสถานะ/ติ่งกล้อง */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#bigmap[hidden] { display: none; }
.bm-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; color: #fff; }
.bm-head b { font-size: 16px; }
#bm-close { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #ffffff22; color: #fff; font-size: 15px; cursor: pointer; }
#bigmap-cv { width: min(88vw, 88vh, 560px); height: min(88vw, 88vh, 560px); image-rendering: pixelated;
  border-radius: 10px; border: 2px solid #e8b64a; background: #0b1524; touch-action: none; }
.bm-hint { margin-top: 8px; color: #ffe9b8; font-size: 12px; }
#minimap { cursor: zoom-in; touch-action: none; }   /* คลิก = กางแผนที่เต็มจอ (ui.js initMap · 2 ต.ค.) */

/* ── ลากสกิล/ไอเท็มไปวางช่องลัด ────────────────────────────────────── */
.drag-ghost { position: fixed; z-index: 90; width: 42px; height: 42px; margin: -21px 0 0 -21px; border-radius: 8px;
  display: grid; place-items: center; font: 700 13px/1 var(--font); color: #fff; text-shadow: 0 1px 2px #000;
  border: 2px solid #fff8; box-shadow: 0 6px 16px #0007; pointer-events: none; opacity: .92; }
/* ระหว่างลาก แถบช่องลัดต้องลอยเหนือหน้าต่างที่เปิดอยู่ — บนมือถือหน้าต่างเป็นแผ่นเต็มครึ่งจอล่าง
   ถ้าไม่ยกขึ้นมา ช่องลัดจะอยู่ใต้แผ่น ลากไปวางไม่ได้เลย (เจอในเทสต์รอบแรก) */
html.assigning #hotbar { z-index: 80 !important; }
html.assigning #hotbar .slot { outline: 2px dashed #e8b64a; outline-offset: -2px; }
html.assigning #hotbar .slot.drop { outline: 3px solid #ffd76a; background: #ffe9a855; transform: scale(1.06); }

/* ── หน้าสร้างตัวละคร: ช่องชื่อ + ปุ่มสุ่ม ─────────────────────────── */
.name-row { display: flex; gap: 6px; align-items: stretch; }
.name-row input { flex: 1; min-width: 0; }
#l-dice { flex: none; width: 44px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(#fdf3dd, #e7cf9a);
  font-size: 18px; cursor: pointer; }
#l-dice:active { transform: scale(.94); }

/* กันหน้าเด้ง/รีเฟรชตอนลากนิ้วบนมือถือ — เกมกินทั้งจออยู่แล้ว ไม่มีอะไรให้เลื่อน */
html, body { overscroll-behavior: none; }

/* แถบซูมใต้แผนที่เต็มจอ */
.bm-zoom { display: flex; align-items: center; gap: 12px; margin-top: 10px; color: #ffe9b8; font-size: 13px; }
.bm-zoom button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid #e8b64a99; background: #ffffff1a;
  color: #ffe9b8; font: 700 18px/1 system-ui; cursor: pointer; }
.bm-zoom button:disabled { opacity: .35; cursor: default; }

/* ปุ่มของแต่ละแถวสกิล — เรียงลงบนจอคอม (มีที่พอ) เรียงข้างกันบนมือถือ (ประหยัดความสูง) */
.sk-btns { display: flex; flex-direction: column; gap: 2px; }

/* แท็บของแผ่น "ตัวละคร" บนมือถือ (สวมใส่ / กระเป๋า) */
.gear-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.gear-tabs button { flex: 1; min-height: 40px; font: 600 13px/1 inherit; border: 1px solid var(--line);
  border-radius: 9px; background: linear-gradient(var(--btn-a), var(--btn-b)); color: var(--ink); cursor: pointer; }
.gear-tabs button.on { background: linear-gradient(#7ea3e4, #4a72c0); color: #fff; border-color: #3a5a9a; }

/* ═══════════════════════════════════════════════════════════════════════════
   ผังจอคอมรอบใหม่ (รีวิว UX รอบ PC) — Layout ก่อน แล้วค่อย skin
   เดิมทุกอย่างกระจุกซ้ายบน: แผงข้อมูล + ปุ่มเมนู 7 ปุ่ม + เสียง + fps + ช่องลัด
   ผังที่คนเล่น MMO บนคอมคุ้นเคยคือ ช่องลัดอยู่กลางล่าง แชทซ้ายล่าง เมนูขวาล่าง
   สายตาตอนสู้จะได้วิ่งแค่ ตัวละคร → ศัตรู → ช่องลัดด้านล่าง ไม่ต้องกวาดขึ้นมุมบน
   (กฎทั้งบล็อกนี้ไม่แตะจอสัมผัส — มือถือมีผังของตัวเองใน ui-mobile.css)
   ═══════════════════════════════════════════════════════════════════════════ */
html:not(.touch-ui) #hotbar {
  top: auto; bottom: 10px; left: 50%; transform: translateX(-50%);
  gap: 3px; padding: 4px 5px; z-index: 12;
}
html:not(.touch-ui) #hotbar .slot { width: 44px; height: 44px; }

/* แชท: ของเดิมสูง 110px กว้าง 560 — เตี้ยเกินกว่าจะตามบทสนทนาทัน */
html:not(.touch-ui) #chat-log { width: min(430px, 34vw); height: 190px; font-size: 12.5px; line-height: 1.45; }
html:not(.touch-ui) #chat.big #chat-log { height: 340px; }
/* แถบแท็บกับแถบพิมพ์ต้องกว้างเท่ากล่องข้อความ ไม่ใช่ยาวเต็มจอ
   (ปุ่ม ⇕ เคยไปลอยอยู่กลางจอเพราะแถบแท็บกว้างเท่าหน้าจอ) */
html:not(.touch-ui) .chat-tabs,
html:not(.touch-ui) .chat-bar { width: calc(min(430px, 34vw) + 12px); }

/* ปุ่มเมนูย้ายไปมุมขวาล่างเป็นแถวเดียว — ออกจากแผงข้อมูลตัวละคร */
html:not(.touch-ui) .bi-btns {
  position: fixed; right: 10px; bottom: 10px; z-index: 12;
  flex-direction: row; flex-wrap: wrap-reverse; justify-content: flex-end;
  gap: 4px; align-items: flex-end; max-width: 250px;      /* พับเป็นสองแถวแทนที่จะไปชนช่องลัดกลางจอ */
}
html:not(.touch-ui) .bi-btns .rbtn { width: auto; min-width: 56px; padding: 0 8px; min-height: 26px; font-size: 12px; }

/* เสียง/ความลื่น/fps ไม่ใช่ข้อมูลที่ต้องเห็นตลอดเวลา — ไปอยู่เหนือแถวเมนู */
html:not(.touch-ui) .bi-zeny .snd {
  position: fixed; right: 10px; bottom: 76px; z-index: 12;   /* เหนือแถวเมนูที่พับได้สองแถว */
  margin: 0; gap: 3px; align-items: center;
}
html:not(.touch-ui) .bi-zeny .snd .rbtn { min-height: 22px; font-size: 11px; padding: 0 7px; }
html:not(.touch-ui) .bi-zeny { justify-content: flex-start; }

/* แผงข้อมูลตัวละคร: เหลือแค่ชื่อ อาชีพ HP SP เลเวล เงิน — หายใจได้ขึ้น */
/* ความกว้างย้ายไป ui-kit.css แล้ว (การ์ดใหม่) — กฎนี้เคยชนะเพราะมี :not() พ่วงมา
   ทำให้ไฟล์ที่โหลดทีหลังแก้ความกว้างไม่ได้ ทั้งที่ควรจะแก้ได้ */
html:not(.touch-ui) .bi-name b { font-size: 14px; }
html:not(.touch-ui) .bi-bar, html:not(.touch-ui) .bi-lv { margin-bottom: 3px; }

/* ── จอคอม: เพิ่มที่ว่างและขนาดตัวอักษร (รีวิวบอกว่าแน่นเกินและตัวเล็กเกิน) ──
   เป้าหมาย: ตัวอักษรในหน้าต่าง ~13px · แถวสูงขึ้น ~25% · ปุ่มเล็กสุดที่ยังกดสบาย
   ทำเฉพาะจอคอม (มือถือมีชุดของตัวเองใน ui-mobile.css ที่ใหญ่กว่านี้อยู่แล้ว) */
html:not(.touch-ui) .win .body { padding: 9px 11px 11px; font-size: 13px; }
html:not(.touch-ui) .win .foot { padding: 6px 11px; }
html:not(.touch-ui) .st-row { height: 24px; gap: 5px; }
html:not(.touch-ui) .st-row b { width: 30px; }
html:not(.touch-ui) .st-row .up { width: 22px; height: 20px; font-size: 10px; line-height: 18px; }
html:not(.touch-ui) .st-row .cost { width: 16px; font-size: 11px; }
html:not(.touch-ui) .st-col + .st-col { padding-left: 10px; }
html:not(.touch-ui) .sk-row { padding: 7px 4px; gap: 9px; }
html:not(.touch-ui) .sk-row .nm { font-size: 13.5px; }
html:not(.touch-ui) .sk-row .lv { font-size: 11.5px; }
/* กระเป๋า: ช่องใหญ่ขึ้นให้เห็นไอคอนจริง ๆ (รีวิวแนะนำ 48-52px) */
html:not(.touch-ui) .grid { grid-template-columns: repeat(auto-fill, 46px); gap: 5px; }
html:not(.touch-ui) .grid .slot { width: 46px; height: 46px; font-size: 24px; }
html:not(.touch-ui) .vtabs button { font-size: 11px; padding: 8px 0; }
/* ตัวละครในหน้าสวมใส่คือจุดขายของเกม — ให้ใหญ่ขึ้น ~25% */
html:not(.touch-ui) .cprev { height: 236px; }

/* ปุ่มเพิ่มสเตตัส: ใช้ "+" แทน ▲ (อ่านง่ายกว่าและไม่พึ่งฟอนต์สัญลักษณ์)
   และต้องมีช่องไฟระหว่างปุ่ม ไม่งั้นขอบมันต่อกันจนดูเป็นกล่องยาวกล่องเดียว */
.st-row .up { display: grid; place-items: center; line-height: 1; font-weight: 700; }
html:not(.touch-ui) .st-row { margin-bottom: 3px; }
html:not(.touch-ui) .st-row .up { width: 24px; height: 20px; font-size: 14px; }

/* ── แถบเมนูมุมขวาล่างของจอคอม ─────────────────────────────────────────
   เดิมใช้ปุ่มตัวหนังสือล้วนที่ยกมาจากในแผงข้อมูล ดูเป็นชิปลอย ๆ ไม่เหมือนส่วนอื่นของเกม
   เปลี่ยนมาใช้ #menu ชุดเดียวกับมือถือ (มีไอคอน + ป้ายกำกับ) จะได้หน้าตาเดียวกันทั้งสองแพลตฟอร์ม */
html:not(.touch-ui) .bi-btns { display: none; }
html:not(.touch-ui) #menu {
  display: flex; position: fixed; right: 10px; bottom: 10px; z-index: 12;
  gap: 5px; flex-wrap: wrap-reverse; justify-content: flex-end; max-width: 340px;
}
html:not(.touch-ui) #menu button {
  width: 58px; height: 48px; display: grid; place-items: center; gap: 1px; padding: 3px 2px;
  font-size: 18px; line-height: 1; border: 1px solid var(--line); border-radius: 9px;
  background: linear-gradient(var(--btn-a), var(--btn-b)); color: var(--ink); cursor: pointer;
}
html:not(.touch-ui) #menu button small { font-size: 10px; opacity: .85; }
html:not(.touch-ui) #menu button:hover { filter: brightness(1.06); }
html:not(.touch-ui) #menu button.attn { border-color: #c0392b; box-shadow: 0 0 0 2px #e8743d55; }

/* เสียง/ความลื่น/fps: จางไว้ ชัดเมื่อเอาเมาส์ไปชี้ — เป็นของที่นาน ๆ แตะที */
html:not(.touch-ui) .bi-zeny .snd { bottom: 66px; opacity: .55; transition: opacity .15s; }
html:not(.touch-ui) .bi-zeny .snd:hover { opacity: 1; }

/* จอคอม: คำแนะนำในแถบปาร์ตี้ให้สั้นลงและจางลง — มันเป็นข้อความสอนใช้ครั้งเดียว
   แต่กินสองบรรทัดของแผงที่ควรบอก "ใครเหลือเลือดเท่าไร" เป็นหลัก */
html:not(.touch-ui) #party-hud .small {
  font-size: 10px; opacity: .55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* หลอด HP/SP ในแผงข้อมูล: ป้ายสั้นลง หลอดยาวขึ้น ตัวเลขเล็กลงให้อยู่ในหลอดพอดี */
html:not(.touch-ui) .bi-main { --bi-label: 44px; }
html:not(.touch-ui) .bi-bar span, html:not(.touch-ui) .bi-lv em { font-size: 10px; }

/* ── รูปหน้า NPC ในกล่องบทสนทนา ─────────────────────────────────────── */
.npc-text.has-face { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; align-items: start; }
.npc-face { width: 84px; height: auto; align-self: start; filter: drop-shadow(0 2px 4px #0003); }
/* ไอคอนอาชีพในกล่องเลือกอาชีพ */
.detail.job-pick { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; align-items: start; }
.job-ic { width: 52px; height: 52px; }

/* โลโก้จริงแทนตัวหนังสือในหน้า login */
.brand { line-height: 0; }
.brand img { width: min(300px, 78%); height: auto; }

/* กล่อง "ยังไม่มีอะไร" — มีภาพประกอบแทนข้อความเปล่า ๆ */
.empty-art { display: grid; place-items: center; gap: 8px; padding: 12px 8px 14px; text-align: center; color: var(--ink-soft); }
.empty-art img { width: 132px; height: auto; opacity: .95; }
.empty-art b { color: var(--ink); font-size: 14px; }
.empty-art p { margin: 0; font-size: 12px; line-height: 1.5; max-width: 260px; }

/* ───────── จอโหลด (สร้างจาก main.js: loadBar) ─────────
   ภาพวาดเต็มจอแทนแถบบาง ๆ ในการ์ด login — ช่วงโหลด 19 MB คือหน้าแรกที่คนใหม่เห็นนานที่สุด
   ภาพเป็นแนวตั้ง 1080x1920 บนจอคอมจะครอบตรงกลาง จึงวางโลโก้/แถบไว้ล่างเสมอ */
#loadscreen { position: fixed; inset: 0; z-index: 60; background: #2c3f4d; overflow: hidden; }
#loadscreen[hidden] { display: none; }
#loadscreen .ls-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }
#loadscreen .ls-fg {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 20px calc(28px + env(safe-area-inset-bottom));
  display: grid; justify-items: center; gap: 12px;
  background: linear-gradient(to top, rgba(24, 32, 46, .9) 42%, rgba(24, 32, 46, 0));
}
#loadscreen .ls-logo { width: min(320px, 62vw); height: auto; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .45)); }
#loadscreen #l-load { width: min(420px, 82vw); display: grid; gap: 6px; font-size: 13px; color: #f6ecd6; text-align: center; }
#loadscreen #l-load[hidden] { display: none; }
#loadscreen #l-load::after {
  content: ''; height: 10px; border-radius: 99px; grid-area: 2/1;
  background: rgba(0, 0, 0, .38); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35);
}
#loadscreen #l-load i {
  height: 10px; border-radius: 99px; grid-area: 2/1; z-index: 1; width: 0;
  background: linear-gradient(#f2c86f, #e1aa3b); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
  transition: width .25s ease-out;
}
#loadscreen .ls-tip {
  max-width: min(460px, 86vw); text-align: center; font-size: 12.5px; line-height: 1.5;
  color: #dfd3ba; text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

/* จอกว้าง: ภาพเป็นแนวตั้ง 9:16 — ครอบเต็มจอแล้วซูมจนหน้าตัวละครชนโลโก้ ส่วนถ้าเลื่อนหนี
   ก็เหลือแต่ฟ้าเปล่า ๆ (ลองมาแล้วทั้งสองแบบที่ 1280x800) จึงวางภาพเต็มใบไว้กลางจอ
   แล้วใช้ภาพเดิมเบลอเป็นพื้นหลังสองข้าง — เห็นภาพครบทั้งใบ ไม่ว่าจอจะกว้างแค่ไหน */
@media (min-aspect-ratio: 4/3) {
  #loadscreen::before {
    content: ''; position: absolute; inset: -40px;
    background: url('assets/ui/loading.jpg') center/cover; filter: blur(36px) brightness(.55);
  }
  #loadscreen .ls-art { object-fit: contain; object-position: 50% 50%; }
  /* 0.5625 = 1080/1920 — ความกว้างที่ภาพกินจริงเมื่อถูกจำกัดด้วยความสูงจอ */
  #loadscreen .ls-fg { left: 50%; right: auto; transform: translateX(-50%); width: calc(100vh * 0.5625); }
  #loadscreen .ls-logo { width: min(300px, 62%); }
}

/* ═══════ หน้า login / สร้างตัวละคร รอบปรับใหญ่ (21 ก.ย.) ═══════
   ปัญหาเดิม: การ์ดกลางจอกว้าง 360px ตัวหนังสือ 13px ช่องกรอกเป็นช่องมาตรฐานเบราว์เซอร์
   พื้นหลังวาดมาสวยกว่าฟอร์มอยู่ระดับหนึ่ง คนดูออกว่าเป็น "ฟอร์ม HTML ในกรอบเกม"
   โทนสีที่ใช้ตรงนี้: ครีม #f5e8c8 · ทอง #e8b64a · ทองเข้ม #a87825 · teal #2f6f73 */

/* กำลังเชื่อมต่อ — กันฟอร์มบัญชีแวบขึ้นมาก่อนรู้ว่าเซิร์ฟเวอร์รับบัญชีไหม */
#l-boot { display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 26px 0; color: var(--ink-soft); font-size: 14px; }
#l-boot[hidden] { display: none; }
#l-boot .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #0000002e;
  border-top-color: #a87825; animation: l-spin .8s linear infinite; }
@keyframes l-spin { to { transform: rotate(360deg); } }

/* ปุ่มหลักเต็มแถว — เดิม "เข้าสู่ระบบ" กับ "สมัครบัญชีใหม่" เป็นปุ่มขนาดใกล้กันสองอัน
   ที่แข่งกันเอง คนใหม่ต้องหยุดอ่านว่าจะกดอันไหน */
.primary.wide { width: 100%; }
.alt { text-align: center; font-size: 13px; color: var(--ink-soft); }
.alt[hidden] { display: none; }

/* ช่องรหัสผ่าน + ปุ่มตา */
.pw-row { display: flex; align-items: stretch; gap: 0; position: relative; }
.pw-row input { flex: 1; min-width: 0; padding-right: 42px; }
.eye { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 38px; border: 0;
  background: none; font-size: 15px; opacity: .5; cursor: pointer; }
.eye:hover, .eye.on { opacity: 1; }

/* หน้าสร้างตัวละคร: มือถือเรียงลง จอคอมแบ่งสองคอลัมน์ (กฎจอคอมอยู่ข้างล่าง) */
.cc { display: grid; gap: 10px; }
.cc-opt { display: grid; gap: 10px; align-content: start; }
/* ป้ายบอกวิธีหมุน: วางทับเท้าตัวละครพอดีจนอ่านไม่ออก ต้องมีพื้นหลังของตัวเอง */
.cprev-tip { position: absolute; left: 50%; transform: translateX(-50%); bottom: 6px;
  font-size: 11px; font-style: normal; line-height: 1; padding: 4px 9px; border-radius: 99px;
  background: rgba(255, 253, 246, .82); color: var(--ink-soft); pointer-events: none; }

/* ใบหน้าตัวจริงในหน้าเลือกตัวละคร */
.slot-card { grid-template-columns: auto minmax(0, 1fr) auto; }
.slot-card.empty { grid-template-columns: 1fr; }
.pf { width: 46px; height: 46px; border-radius: 8px; overflow: hidden;
  background: linear-gradient(#eaf1fb, #dbe6f6); }
.pf img { width: 100%; height: 100%; display: block; }

/* ── เฉพาะจอคอม: ขยายทุกอย่างขึ้นหนึ่งระดับ ───────────────────────── */
html:not(.touch-ui) .login-card { width: min(440px, 100%); font-size: 15px; gap: 13px; padding: 22px 24px; }
html:not(.touch-ui) .login-card .sub { font-size: 13px; }
html:not(.touch-ui) .login-card label { gap: 6px; font-size: 15px; }
html:not(.touch-ui) .login-card input {
  min-height: 46px; font-size: 15px; padding: 8px 12px; border-radius: 7px;
  background: #fdf7e8; border: 1px solid #c9a96a; color: #3b3028;
}
html:not(.touch-ui) .login-card input::placeholder { color: #a99a84; }
html:not(.touch-ui) .login-card input:focus {
  outline: 0; border-color: #2f6f73; box-shadow: 0 0 0 3px rgba(47, 111, 115, .22);
}
html:not(.touch-ui) .login-card .primary { min-height: 50px; font-size: 17px; border-radius: 10px; }
html:not(.touch-ui) .login-card .chip { min-height: 34px; font-size: 14px; padding: 4px 14px; border-radius: 10px; }
html:not(.touch-ui) .login-card .row > span { width: 62px; font-size: 14px; }
html:not(.touch-ui) .login-card .swatches { gap: 7px; }
html:not(.touch-ui) .login-card .swatches button { width: 30px; height: 30px; }
html:not(.touch-ui) .login-card .hint { font-size: 12px; }
html:not(.touch-ui) .pf { width: 58px; height: 58px; }

/* หน้าสร้างตัวละครไม่ใช้การ์ดแคบของหน้า login — ตัวละครคือของที่คนมาดู
   สองคอลัมน์ทำให้ตัวใหญ่ขึ้นได้โดยไม่ต้องดันฟอร์มลงไปนอกจอ */
html:not(.touch-ui) .login-card:has(#l-create:not([hidden])) { width: min(680px, 100%); }
html:not(.touch-ui) #l-create .cc { grid-template-columns: minmax(0, 250px) minmax(0, 1fr); gap: 18px; }
html:not(.touch-ui) #l-create .cprev { height: 306px; }
html:not(.touch-ui) #l-create .cc-opt { gap: 14px; }
html:not(.touch-ui) #l-create .cc { margin-top: 4px; }

/* หน้าเลือกตัวละคร: การ์ดกว้างกว่าหน้า login เพราะมีรูปหน้า + ชื่อ + ปุ่มในแถวเดียว */
html:not(.touch-ui) .login-card:has(#l-chars:not([hidden])) { width: min(500px, 100%); }
html:not(.touch-ui) .slot-card { gap: 6px 12px; padding: 9px 11px; }
html:not(.touch-ui) .slot-card .nm { font-size: 16px; font-weight: 700; }
html:not(.touch-ui) .slot-card .jb { font-size: 12px; color: var(--ink-soft); }
html:not(.touch-ui) .slot-card .primary { min-height: 38px; font-size: 14px; padding: 6px 14px; }
html:not(.touch-ui) .slot-card .link { font-size: 13px; }
html:not(.touch-ui) .login-card > .hint { text-align: center; }

/* ── ทางเข้าเกม: Google / Apple เท่านั้น (21 ก.ย.) ─────────────────────── */
.primary.full { width: 100%; }
.auth-lead { text-align: center; font-size: 14px; font-weight: 700; color: #5a4218; margin: 2px 0 4px; }
.gbtn { display: flex; justify-content: center; min-height: 44px; }
.gbtn[hidden] { display: none; }
/* ปุ่ม Apple ตาม Human Interface Guidelines: พื้นดำ โลโก้+ข้อความขาว ขนาดเท่าปุ่ม Google ข้าง ๆ
   (ห้ามเปลี่ยนสีให้เข้าธีมไม้-ทอง — Apple กำหนดสีปุ่มไว้แค่ดำ/ขาว/ขาวมีขอบ) */
.abtn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; max-width: 360px;
  justify-self: center; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px;
  background: #000; color: #fff; font: 600 15px/1 inherit; cursor: pointer; }
.abtn svg { width: 15px; height: 18px; flex: none; margin-top: -2px; }
.abtn:active { background: #222; }
.abtn[hidden] { display: none; }
/* ย้ายบัญชีเก่า — พับไว้ คนใหม่ไม่ต้องเห็น คนที่เคยเข้าด้วยรหัสในเครื่องนี้จะกางให้เอง */
#l-oldbox > summary { cursor: pointer; text-align: center; font-size: 13px; color: #6b5423;
  padding: 9px 10px; border: 1px dashed #cbb076; border-radius: 10px; list-style: none; background: #fffaf0; }
#l-oldbox > summary::-webkit-details-marker { display: none; }
#l-oldbox > summary::after { content: ' ▾'; }
#l-oldbox[open] > summary::after { content: ' ▴'; }
#l-oldbox[open] > summary { margin-bottom: 10px; }
.old-how { font-size: 12.5px; line-height: 1.5; color: #5a4218; background: #fff4d6; border-radius: 8px; padding: 7px 9px; }
.pwbox { display: grid; gap: 10px; }
#l-noauth { text-align: center; }
/* แถบเตือนบัญชีที่ยังไม่ผูกในหน้าเลือกตัว */
.bind { display: grid; gap: 8px; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.45;
  background: #fff4d6; border: 1px solid #e8b64a; color: #5a4218; }
.bind[hidden] { display: none; }
html.touch-ui #l-oldbox > summary { min-height: 46px; padding: 13px 10px; font-size: 14px; }

/* ── ฟอนต์หัวข้อ (Mitr): ของที่ต้องอ่านออกจากหางตา ─────────────────────
   หัวหน้าต่าง ปุ่มหลัก ชื่อบนหัว ตัวเลขดาเมจ ป้ายกลางจอ — เนื้อความทั้งหมดยังเป็น Anuphan
   (Mitr กว้าง ใช้กับตัวหนังสือเล็กแล้วบรรทัดล้น: เทียบแล้วบรรทัด HP/SP/Gold ตกเป็นสองบรรทัด) */
.rwin > header, .win > header, .primary, .btn.main, .actions button.main,
.label, .dmg, #toast, .bi-name b, #goal b, .slot-card .nm, .or, #l-pwbox > summary { font-family: var(--font-head); }
.dmg, #toast { font-weight: 600; }
/* แถบล่างหน้าต่าง: กลุ่มปุ่มด้านขวาห้ามหักบรรทัด — พอเปลี่ยนเป็น Anuphan (กว้างกว่า Tahoma นิด)
   ปุ่ม auto: melee / auto: magic ในหน้าสถานะเคยตกลงมาซ้อนเป็นสองแถว ให้คำอธิบายซ้ายหักแทน */
.win .foot { gap: 8px; }
.win .foot > span:last-child:has(button) { white-space: nowrap; flex: none; }


/* ── ตอนตาย: สองทางเลือก + แถบเตือนตอนปิดป๊อปอัปไปแล้ว ─────────────────────
   เดิมมีปุ่มเดียวคือกลับจุดเซฟ พอเพื่อนกำลังวิ่งมาชุบให้ ก็ไม่มีทางเลือก "นอนรอ"
   และถ้าปิดป๊อปอัปไปแล้วจะกลับจุดเซฟไม่ได้อีกเลย จนกว่าจะรีเฟรช */
.dth-acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 9px; }
.dth-acts .rbtn { margin-top: 0; min-width: 132px; }
.rbtn.ghost { background: linear-gradient(#f2eee4, #ded7c6); color: #5a5246; }
.rbtn.ghost:hover { background: linear-gradient(#fffdf6, #e8e1d0); }
.dth-hint { margin-top: 7px; opacity: .8; }
#dead-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 60; display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 14px; border-radius: 999px;
  background: #2a2336e6; color: #f0ead8; font: 500 13px/1 var(--font-head); box-shadow: 0 4px 14px #0005; }
#dead-bar .rbtn { min-height: 30px; padding: 4px 12px; font-size: 13px; }

/* ── จำนวนคนออนไลน์บนหน้า login ─────────────────────────────────────────
   คนที่เปิดลิงก์ที่เราแชร์ ควรเห็นตั้งแต่ยังไม่ล็อกอินว่ามีคนเล่นอยู่จริงกี่คน */
.l-online { display: inline-flex; align-items: center; gap: 7px; margin: 2px auto 0; padding: 4px 12px;
  border-radius: 999px; background: #2f6f7316; color: #2f6f73; font: 600 13px/1 var(--font-head); }
.l-online i { width: 8px; height: 8px; border-radius: 50%; background: #3fbf6a; box-shadow: 0 0 0 3px #3fbf6a33; }
.l-online.zero { background: #8a827416; color: #7a7266; }
.l-online.zero i { background: #b9b2a4; box-shadow: none; }

/* Shadow Burst พร้อมระเบิด (เป้ามีตราเงา 3+) — ช่องทั้งช่องเรืองม่วงเต้น + ป้าย ×N มุมซ้ายล่าง (ขวาบนเป็นตรา AUTO · ขวาล่างเลขเลเวล)
 * ใช้ ::after ไม่แตะ box-shadow ที่สกินต่าง ๆ ใช้กับ .armed */
.slot.sk-ready::after, [data-slot].sk-ready::after {
  content: attr(data-mk); position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3;
  display: flex; align-items: flex-end; justify-content: flex-start; padding: 0 0 2px 3px; box-sizing: border-box;
  background: radial-gradient(circle, #b890e855 30%, #8a5ae830 70%); border: 2px solid #b890e8;
  font: 800 11px/1 system-ui, sans-serif; color: #fff; text-shadow: 0 0 3px #3a2a58, 0 0 3px #3a2a58, 0 0 2px #3a2a58;
  animation: skReady .7s ease-in-out infinite alternate;
}
@keyframes skReady { from { border-color: #b890e8; box-shadow: 0 0 4px 1px #8a5ae899; } to { border-color: #f0e8ff; box-shadow: 0 0 12px 3px #8a5ae8; } }
/* ช่วงทดสอบเข้าด้วยชื่อ: ตัวที่ผูก Google แล้วกลับเข้าทางนี้ (main.js · account-link.js) */
.name-gg { display: grid; gap: 4px; justify-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e2cc98; }
.name-gg[hidden] { display: none; }
.name-gg small { color: #8a7656; font-size: 12.5px; }
