/* หน้าเข้าสู่ระบบ + หน้าต่างในเกม — โทนกลางคืนบนเกาะลอยฟ้า ปุ่มสีทองอุ่น */
:root {
  --bg: #16233a;
  --panel: rgba(18, 28, 48, 0.94);
  --panel-edge: #3b5378;
  --ink: #f2f5fb;
  --ink-dim: #a9b6cc;
  --gold: #f5c83c;
  --gold-ink: #3a2a00;
  --green: #7fe08a;
  --red: #ff8a7a;
  --radius: 12px;
  --font: 'Noto Sans Thai', system-ui, sans-serif;
  --display: 'Mitr', 'Noto Sans Thai', sans-serif;
}

html, body {
  margin: 0; height: 100%; background: var(--bg); overflow: hidden; color: var(--ink); font-family: var(--font);
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none;
}
#game { width: 100%; height: 100%; }
canvas { image-rendering: pixelated; }
button, input { font: inherit; color: inherit; }
input { user-select: text; -webkit-user-select: text; }

/* ---------- ปุ่ม ---------- */
.btn {
  border: 1px solid var(--panel-edge); background: #24385a; border-radius: 999px; padding: 8px 16px; cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover:not(:disabled) { background: #2e4770; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--gold); border-color: #ffe07a; color: var(--gold-ink); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #ffd65c; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:focus-visible, .option:focus-visible, .tab:focus-visible, .link:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.link { background: none; border: 0; color: var(--gold); cursor: pointer; padding: 0; text-decoration: underline; }
.icon-btn { background: none; border: 0; color: var(--ink-dim); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }

/* ---------- หน้าเข้าสู่ระบบ ---------- */
#auth {
  position: fixed; inset: 0; z-index: 20; display: flex; padding: 16px; overflow-y: auto;
  background: linear-gradient(to bottom, rgba(22, 35, 58, 0.25), rgba(22, 35, 58, 0.85)), url('/assets/bg.png') center bottom / cover no-repeat, #aed3f0;
  image-rendering: pixelated;
}
#auth[hidden] { display: none; }

/* หน้าโหลด (client/loading.ts): โปสเตอร์เต็มจอ + แถบความคืบหน้าล่างจอ · อยู่เหนือเกม/หน้าเข้าสู่ระบบ แต่ใต้หน้าหมุนจอ/เต็มจอของมือถือ */
#loading {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px max(28px, env(safe-area-inset-bottom));
  /* ภาพวางโลโก้ไว้ช่วงบน-กลาง ล่างโล่งไว้ให้แถบโหลด → จอยาวกว่า 16:9 (มือถือแนวนอน) ตัดล่างมากกว่าบน (center 30%) โลโก้ไม่หลุดขอบบน */
  background: linear-gradient(to bottom, transparent 55%, rgba(10, 18, 36, 0.85)), url('/loading-bg.jpg?v=2') center 30% / cover no-repeat, #1d2f4a;
  transition: opacity 0.4s ease;
}
/* จอแนวตั้ง (มือถือถือตั้ง / แท็บเล็ต) ใช้ภาพแนวตั้ง 9:16 */
@media (orientation: portrait) {
  #loading { background-image: linear-gradient(to bottom, transparent 60%, rgba(10, 18, 36, 0.85)), url('/loading-bg-portrait.jpg'); background-position: center, center 30%; }
}
#loading[hidden] { display: none; }
#loading.done { opacity: 0; pointer-events: none; }
.loading-panel { width: min(520px, 100%); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.loading-bar {
  width: 100%; height: 14px; padding: 2px; border-radius: 999px; background: rgba(10, 16, 34, 0.75);
  border: 1.5px solid rgba(255, 224, 122, 0.75); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
.loading-bar span {
  display: block; height: 100%; width: 0; border-radius: 999px; transition: width 0.25s ease-out;
  background: linear-gradient(90deg, #ffd24a, #fff0a8, #ffd24a); background-size: 200% 100%; animation: loading-shine 1.4s linear infinite;
}
@keyframes loading-shine { from { background-position: 200% 0; } to { background-position: 0 0; } }
/* วาฬว่ายนำหน้าแถบโหลด (logo.svg หันซ้าย → กลับด้านให้ว่ายไปขวา) */
.loading-bar span { position: relative; }
.loading-whale {
  position: absolute; right: -30px; bottom: 2px; width: 64px; height: 64px; pointer-events: none;
  transform: scaleX(-1); filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5)); animation: loading-swim 1.2s ease-in-out infinite;
}
@keyframes loading-swim { 50% { transform: scaleX(-1) translateY(-6px) rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .loading-whale { animation: none; } }
@media (max-height: 420px) { .loading-whale { width: 48px; height: 48px; right: -22px; } }
.loading-text { margin: 0; font: 500 16px var(--display); color: #fff7dc; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8); }
.loading-text b { color: var(--gold); margin-left: 6px; font-variant-numeric: tabular-nums; }
.loading-tip { margin: 0; min-height: 1.4em; font-size: 13px; color: #dfe8f7; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9); }
@media (max-height: 420px) { #loading { padding-bottom: 14px; } .loading-text { font-size: 14px; } .loading-tip { font-size: 12px; } }
.auth-card {
  width: min(440px, 100%); margin: auto; background: var(--panel); /* margin auto = กลางจอ แต่ถ้าจอเตี้ยก็เลื่อนดูได้ ไม่โดนตัดขอบบน */ border: 1px solid var(--panel-edge); border-radius: 18px;
  padding: 28px 24px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); image-rendering: auto;
}
/* สลับภาษา (client/i18n.ts) มุมขวาบนของการ์ดหน้าแรก */
.auth-card { position: relative; }
.lang-switch { position: absolute; top: 12px; right: 12px; display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(0, 0, 0, 0.28); z-index: 1; }
.lang-switch button { border: 0; background: none; color: var(--ink-dim); font: inherit; font-size: 12px; padding: 3px 9px; border-radius: 999px; cursor: pointer; }
.lang-switch button.on { background: var(--gold); color: #3a2400; font-weight: 700; }
.lang-switch button:not(.on):hover { color: var(--ink); }
.vol-row .lang-switch { position: static; }
.brand { text-align: center; margin-bottom: 20px; }
.brand-logo { display: block; width: 96px; height: 96px; margin: -12px auto -14px; animation: brand-bob 3s ease-in-out infinite; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
@keyframes brand-bob { 50% { transform: translateY(-5px) rotate(-3deg); } }
@media (prefers-reduced-motion: reduce) { .brand-logo { animation: none; } }
.brand-title { font-family: var(--display); font-size: 34px; font-weight: 500; color: var(--gold); letter-spacing: 0.5px; text-shadow: 0 3px 0 #5a3a00; }
.brand-sub { color: var(--ink-dim); font-size: 13px; margin-top: 2px; }
.test-badge { display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 999px; background: #5a3a0a; color: #ffe6a8; font-size: 12px; }
/* ติดตั้งเกมลงเครื่อง (client/install.ts) */
.install { margin-top: 14px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(174, 211, 240, 0.25); }
.install-title { font-size: 13px; font-weight: 600; color: var(--ink); text-align: center; margin-bottom: 8px; }
.install-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.install-btn { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 4px; border-radius: 10px; cursor: pointer; font: inherit; font-size: 12.5px;
  color: var(--ink); background: rgba(0, 0, 0, 0.25); border: 1.5px solid rgba(255, 255, 255, 0.12); }
.install-btn:hover { background: rgba(255, 255, 255, 0.08); }
.install-btn.here { border-color: #5aa8e8; }
.install-btn.on { border-color: var(--gold); background: rgba(255, 224, 122, 0.1); }
.install-btn small { font-size: 10.5px; color: #8fe0a0; font-weight: 600; }
.install-guide { margin-top: 8px; font-size: 12.5px; line-height: 1.55; color: var(--ink); }
.install-guide ol { margin: 0; padding-left: 20px; }
.install-link { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 8px; margin-top: 8px; }
.install-link code { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.3); user-select: all; -webkit-user-select: all; }
.install-qr { flex-basis: 100%; display: flex; justify-content: center; }
.install-qr svg { background: #fff; border-radius: 8px; width: 132px; height: 132px; }
.install-note { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-dim); }
.install-done { text-align: center; font-size: 13px; color: #8fe0a0; }
.big-play { font-size: 20px; padding: 14px 18px; }
.hint.center { text-align: center; margin-top: 8px; }
/* บันทึกบัญชีผู้เล่นทั่วไป (client/claim.ts) */
.claim-overlay { position: fixed; inset: 0; z-index: 60; display: flex; padding: 12px; overflow: auto; background: rgba(4, 10, 20, 0.7); }
.claim-overlay .auth-card { margin: auto; }
.claim-overlay .auth-form { margin: 12px 0; }
.claim-nudge { position: fixed; z-index: 55; left: 50%; top: max(8px, env(safe-area-inset-top)); transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  max-width: calc(100vw - 24px); padding: 8px 10px 8px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--gold); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); font-size: 13px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 14px; font-size: 13px; }
/* ติดตั้งเกม + ลิงก์ (client/auth.ts): จอแคบ = ใต้การ์ด · จอกว้าง = แผงลอยฝั่งซ้าย */
#auth { flex-direction: column; }
#auth > .auth-card { margin: auto auto 0; }
.auth-side { width: min(440px, 100%); margin: 12px auto auto; image-rendering: auto; }
.auth-side .install { margin-top: 0; background: var(--panel); border-color: var(--panel-edge); }
.auth-side .auth-links { margin: 10px 0 0; }
.auth-side .auth-links a { color: #dfe8f7; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
@media (min-width: 1000px) and (min-height: 521px) {
  #auth > .auth-card { margin: auto; }
  .auth-side {
    position: fixed; left: 24px; top: 50%; transform: translateY(-50%); width: 300px; max-height: calc(100% - 32px); overflow-y: auto; margin: 0;
    padding: 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--panel-edge); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  }
  .auth-side .install { background: rgba(255, 255, 255, 0.05); border-color: rgba(174, 211, 240, 0.25); }
  .auth-side .install-btn { white-space: nowrap; font-size: 12px; }
  .auth-side .auth-links { flex-direction: column; gap: 6px; margin-top: 12px; }
  .auth-side .auth-links a { display: block; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); color: var(--ink); text-shadow: none; }
  .auth-side .auth-links a:hover { background: rgba(255, 255, 255, 0.1); }
}
.auth-links a { color: var(--ink-dim); text-decoration: none; }
.auth-links a:hover { color: var(--ink); }
.auth-card h2 { font-family: var(--display); font-weight: 400; font-size: 20px; margin: 4px 0 14px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; background: rgba(0, 0, 0, 0.25); padding: 4px; border-radius: 999px; }
.tab { flex: 1; border: 0; background: none; padding: 8px; border-radius: 999px; cursor: pointer; color: var(--ink-dim); }
.tab.active { background: #2e4770; color: var(--ink); }
.tabs.small { align-items: center; }
.tabs.small .tab { flex: 0 1 auto; padding: 5px 12px; font-size: 13px; white-space: nowrap; }
.win .tabs { margin-bottom: 0; }
.tabs .shell { margin-left: auto; padding-right: 10px; color: var(--gold); font-weight: 600; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-dim); }
.field input {
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--panel-edge); border-radius: 10px; padding: 10px 12px; font-size: 16px; color: var(--ink);
}
.field input:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
.hint { color: var(--ink-dim); font-size: 12px; margin: 0; }
.form-error { color: var(--red); font-size: 14px; min-height: 1.2em; }
.divider { text-align: center; color: var(--ink-dim); font-size: 12px; margin: 16px 0 10px; }
.google-btn { display: flex; justify-content: center; }
.account-bar { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-dim); margin-bottom: 8px; }
.slots { display: grid; gap: 10px; }
.slot { border-radius: 14px; border: 1px solid var(--panel-edge); padding: 10px 12px; min-height: 64px; }
.slot.filled {
  display: grid; grid-template-columns: 72px 1fr auto; align-items: center; gap: 12px;
  background: linear-gradient(180deg, rgba(58, 72, 128, 0.55), rgba(24, 30, 60, 0.6)); border-color: rgba(170, 190, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); transition: border-color 0.15s, transform 0.15s;
}
.slot.filled:hover { border-color: rgba(255, 224, 122, 0.6); }
.slot-avatar {
  width: 72px; height: 72px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 85%, rgba(154, 184, 255, 0.35), rgba(10, 14, 26, 0.45) 70%); border: 1px solid rgba(154, 184, 255, 0.25);
}
.slot-figure { display: block; width: 72px; height: 72px; image-rendering: pixelated; }
.slot-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.slot-name { font-weight: 600; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.slot-lv, .slot-job { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.slot-lv { background: linear-gradient(180deg, #ffe07a, #f5b83c); color: #3a2800; font-weight: 700; }
.slot-job { background: rgba(20, 28, 52, 0.85); border: 1px solid rgba(154, 184, 255, 0.3); color: #e8f2ff; }
.slot-meta { color: var(--ink-dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-actions { display: flex; gap: 6px; align-items: center; }
.slot.empty { background: none; border-style: dashed; color: var(--ink-dim); cursor: pointer; font-size: 15px; }
.slot.empty:hover { color: var(--gold); border-color: var(--gold); }

/* ---------- หน้าเลือกตัวละครแบบ MapleStory (client/auth.ts + client/charselect.ts) ----------
   ตัวละครยืนเรียงบนแท่นหินลอยฟ้า · ตัวที่เลือก = แสงส่อง + วงทองใต้เท้า · ข้อมูล + ปุ่มเริ่มเล่นอยู่แผงขวา */
#auth.cs-mode { padding: 0; overflow: hidden auto; image-rendering: auto; }
.cs-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px 18px;
  background: linear-gradient(rgba(10, 16, 32, 0.7), rgba(10, 16, 32, 0));
}
.cs-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cs-brand img { width: 44px; height: 44px; margin: -8px 0; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35)); }
.cs-brand b { font-family: var(--display); font-weight: 500; font-size: 24px; color: var(--gold); text-shadow: 0 2px 0 #5a3a00; white-space: nowrap; }
.cs-brand .test-badge { margin: 0; font-size: 11px; }
.cs-account { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #dfe8f7; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); min-width: 0; }
.cs-account .lang-switch { position: static; }
.cs-user { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-main { flex: 1; min-height: 0; display: flex; gap: 18px; padding: 0 18px 18px; }
.cs-center { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cs-title { font-family: var(--display); font-weight: 400; font-size: 22px; margin: 0; text-align: center; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75); }

.cs-stage { --char-h: clamp(92px, min(16vw, 34vh), 200px); --tag-h: 44px; position: relative; flex: 1; min-height: calc(var(--char-h) + 120px); display: flex; align-items: center; }
.cs-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.cs-row { position: relative; width: 100%; max-width: 980px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 3% 14px; }
/* แท่นหินลอยฟ้า: หญ้าด้านบน ดินด้านล่าง */
.cs-row::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--tag-h) + 40px); z-index: 0;
  border-radius: 48px 48px 45% 45% / 26px 26px 100% 100%;
  background:
    linear-gradient(180deg, #9be27a 0, #6cc25a 12px, #3f8f45 20px, transparent 21px),
    linear-gradient(180deg, #8a6845 20px, #6a4c34 60%, #4a3424);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), inset 0 -10px 18px rgba(0, 0, 0, 0.25);
}
.cs-slot {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  height: calc(var(--char-h) + var(--tag-h) + 60px); padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cs-slot:focus-visible { outline: none; }
.cs-slot:focus-visible .cs-tag { outline: 2px solid var(--gold); outline-offset: 2px; }
/* แสงส่องลงมาที่ตัวที่เลือก */
.cs-beam {
  position: absolute; left: 50%; bottom: calc(var(--tag-h) + 12px); width: calc(var(--char-h) * 0.95); height: calc(100% - var(--tag-h)); transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 240, 190, 0), rgba(255, 236, 170, 0.32));
  clip-path: polygon(32% 0, 68% 0, 100% 100%, 0 100%); opacity: 0; transition: opacity 0.25s; pointer-events: none;
}
.cs-slot.on .cs-beam { opacity: 1; }
/* แท่นใต้เท้า = เงา · ตัวที่เลือก = วงทองเรือง */
.cs-pedestal {
  width: calc(var(--char-h) * 0.62); height: 16px; margin-bottom: 4px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0) 70%); transition: box-shadow 0.25s, background 0.25s;
}
.cs-slot.on .cs-pedestal {
  background: radial-gradient(ellipse, rgba(255, 236, 160, 0.75), rgba(255, 200, 80, 0.25) 55%, rgba(255, 200, 80, 0) 72%);
  box-shadow: 0 0 0 2px rgba(255, 224, 122, 0.85), 0 0 22px 4px rgba(255, 210, 90, 0.5); animation: cs-glow 1.6s ease-in-out infinite;
}
@keyframes cs-glow { 50% { box-shadow: 0 0 0 2px rgba(255, 224, 122, 0.45), 0 0 30px 8px rgba(255, 210, 90, 0.3); } }
/* ป้ายชื่อแบบในเกม */
.cs-tag {
  height: var(--tag-h); box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; max-width: 100%;
  padding: 2px 12px; border-radius: 8px; background: rgba(8, 12, 24, 0.72); border: 1px solid rgba(255, 255, 255, 0.12); line-height: 1.25;
  transition: border-color 0.15s, transform 0.15s;
}
.cs-tag b { font-size: 14px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-tag span { font-size: 11.5px; color: var(--ink-dim); }
.cs-slot:hover .cs-tag { border-color: rgba(255, 224, 122, 0.5); }
.cs-slot.on .cs-tag { border-color: var(--gold); background: rgba(40, 30, 6, 0.85); }
.cs-slot.on .cs-tag b { color: var(--gold); }
/* ภาพพิกเซลระหว่างโหลดตัว HD (หรือแทนตัว HD ถ้าคุณภาพภาพต่ำ) */
.cs-fallback { position: absolute; left: 50%; bottom: calc(var(--tag-h) + 8px); transform: translateX(-50%); pointer-events: none; }
.cs-figure { display: block; width: calc(var(--char-h) * 1.1); height: calc(var(--char-h) * 1.1); image-rendering: pixelated; }
.cs-fallback { visibility: hidden; }
.cs-stage.hd-off .cs-fallback { visibility: visible; }
/* ระหว่างโหลดตัว HD: วงหมุนเล็กๆ เหนือแท่น แทนภาพพิกเซลเก่า */
.cs-slot.filled::after {
  content: ''; position: absolute; left: 50%; bottom: calc(var(--tag-h) + 12px + var(--char-h) * 0.35); width: 30px; height: 30px; margin-left: -15px; z-index: 3;
  border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.25); border-top-color: var(--gold); animation: cs-spin 0.9s linear infinite; pointer-events: none;
}
.cs-stage.hd-on .cs-slot.filled::after, .cs-stage.hd-off .cs-slot.filled::after { display: none; }
@keyframes cs-spin { to { transform: rotate(360deg); } }
.cs-slot.empty { color: var(--ink-dim); }
.cs-plus {
  position: absolute; left: 50%; bottom: calc(var(--tag-h) + 22px + var(--char-h) * 0.25); transform: translateX(-50%);
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; line-height: 1;
  border: 2px dashed rgba(255, 255, 255, 0.45); background: rgba(8, 12, 24, 0.35); color: rgba(255, 255, 255, 0.75); transition: 0.15s;
}
.cs-slot.empty:hover .cs-plus { border-color: var(--gold); color: var(--gold); transform: translateX(-50%) scale(1.08); }
.cs-slot.empty .cs-tag b { font-weight: 500; color: var(--ink-dim); }

/* แผงขวา: ตัวที่เลือก + ปุ่มเริ่มเล่น · ติดตั้งเกม/ลิงก์ใต้แผง */
.cs-side { width: 290px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; }
.cs-info {
  display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--panel-edge); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.cs-info-name { font-family: var(--display); font-size: 24px; color: var(--gold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-info .big-play { margin-top: 6px; }
.cs-del { align-self: center; font-size: 12px; opacity: 0.8; }
.cs-side .form-error:empty { display: none; }
.cs-side .install { margin: 0; background: var(--panel); border-color: var(--panel-edge); }
.cs-side .install-btn { min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.cs-side .auth-links { margin: 0; gap: 4px 12px; justify-content: flex-start; padding: 2px 4px; }
.cs-side .auth-links a { color: #dfe8f7; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); font-size: 12.5px; }
/* จอเตี้ย (มือถือแนวนอน): ย่อหัว ซ่อนหัวข้อ แผงขวาแคบลง */
@media (max-height: 520px) {
  .cs-top { padding: 6px 12px 8px; }
  .cs-brand img { width: 32px; height: 32px; }
  .cs-brand b { font-size: 18px; }
  .cs-title { display: none; }
  .cs-main { gap: 10px; padding: 0 12px 10px; }
  .cs-stage { --tag-h: 38px; }
  .cs-side { width: 230px; }
  .cs-info { padding: 12px; gap: 6px; }
  .cs-info-name { font-size: 19px; }
  .cs-info .big-play { font-size: 17px; padding: 10px 14px; margin-top: 2px; }
  .cs-side .install-btn { font-size: 11px; padding: 5px 2px; }
}
/* จอแคบ (เบราว์เซอร์คอมแคบๆ): แผงข้อมูลลงไปอยู่ใต้เวที */
@media (max-width: 700px) and (min-height: 521px) {
  .cs-main { flex-direction: column; }
  .cs-side { width: auto; overflow: visible; }
  .cs-user { max-width: 140px; }
}

/* ---------- หน้าต่างในเกม ---------- */
/* #ui-layer ถูกวางให้ทับ canvas พอดีจาก game.ts (layout) หน้าต่างจึงไม่หลุดไปอยู่ในขอบดำ */
#ui-layer { position: fixed; inset: 0; pointer-events: none; z-index: 10; overflow: hidden; }
.panel {
  pointer-events: auto; position: absolute; left: 50%; transform: translateX(-50%); bottom: 72px;
  width: min(560px, calc(100% - 24px)); max-height: calc(100% - 150px); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  animation: rise 0.16s ease-out; z-index: 15;
}
.panel.wide { width: min(720px, calc(100% - 24px)); }
.panel[hidden], .tooltip[hidden], .chat-input[hidden] { display: none; }
.npc-id { display: flex; gap: 10px; align-items: center; }
.npc-portrait {
  width: 40px; height: 40px; border-radius: 10px; background: #24385a; position: relative; overflow: hidden;
}
.npc-portrait::after {
  content: ''; position: absolute; inset: 0; background: var(--tint); opacity: 0.55; mix-blend-mode: multiply;
  -webkit-mask: url('/assets/novice.png') center 62% / 80px no-repeat; mask: url('/assets/novice.png') center 62% / 80px no-repeat;
}
.npc-portrait::before { content: ''; position: absolute; inset: 0; background: url('/assets/novice.png') center 62% / 80px no-repeat; image-rendering: pixelated; }

/* ---------- หน้าต่างลากได้ ---------- */
.win {
  pointer-events: auto; position: absolute; min-width: 240px; max-width: calc(100% - 8px); max-height: calc(100% - 70px);
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); animation: rise 0.14s ease-out;
}
.win-head {
  display: flex; justify-content: space-between; align-items: center; padding: 6px 6px 4px 14px; cursor: grab; touch-action: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.win-head:active { cursor: grabbing; }
.win-title { font-family: var(--display); color: var(--gold); font-size: 15px; }
.win-body { padding: 10px 12px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.win-foot { display: flex; justify-content: space-between; font-size: 13px; }
.win-inventory, .win-storage { width: 300px; }
.win-equip { width: 268px; }
.win-stats { width: 300px; }
.win-quests { width: 340px; }
.win-world { width: min(920px, calc(100vw - 24px)); }
.win-menu, .win-keys { width: 300px; }
.dim { color: var(--ink-dim); }
.shell { color: var(--gold); font-weight: 600; }
.bad { color: var(--red) !important; }

/* ---------- ช่องไอเทม ---------- */
.grid { display: grid; grid-template-columns: repeat(6, 42px); gap: 4px; justify-content: center; }
.slot-cell {
  width: 42px; height: 42px; position: relative; display: grid; place-items: center; padding: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.35); border: 1px solid #2c3e5c; border-radius: 8px;
}
.slot-cell.kind-equip, .slot-cell.kind-consume, .slot-cell.kind-material, .slot-cell.kind-quest, .slot-cell.kind-card {
  background: linear-gradient(145deg, #20242b, #14171d); border-color: #414854;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), inset 0 -2px 0 rgba(0,0,0,.25);
}
.slot-cell.gear-cell {
  background: linear-gradient(145deg, #20242b, #14171d);
  border-color: #414854;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), inset 0 -2px 0 rgba(0,0,0,.25);
}
.slot-cell.gear-cell:hover:not(.empty) { border-color: #9bb7d8; box-shadow: 0 0 8px rgba(115, 165, 220, .28), inset 0 1px 0 rgba(255,255,255,.14); }
.gear-lv { position: absolute; left: 2px; bottom: 1px; padding: 0 3px; border-radius: 4px; color: #fff3cf; background: rgba(10,14,24,.82); font-size: 8px; line-height: 12px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.slot-cell.gear-cell .slot-dots { left: auto; bottom: auto; right: 2px; top: 1px; color: #9fe7ff; text-shadow: 0 0 4px #46bfff; }
.slot-cell:hover:not(.empty) { border-color: var(--gold); filter: brightness(1.08); }
.slot-cell.empty { cursor: default; opacity: 0.55; }
.slot-cell.dim .icon { opacity: 0.4; }
.slot-cell .qty { position: absolute; right: 3px; bottom: 1px; font-size: 11px; font-weight: 600; text-shadow: 0 1px 2px #000, 0 0 2px #000; }
.slot-cell .plus { position: absolute; left: 3px; top: 1px; font-size: 10px; font-weight: 600; color: var(--gold); text-shadow: 0 1px 2px #000; }
.slot-label { font-size: 10px; color: var(--ink-dim); text-align: center; line-height: 1.1; }
.icon { display: inline-flex; line-height: 0; }
.icon svg { image-rendering: auto; filter: drop-shadow(0 1px 1px rgba(45, 34, 18, .42)); }
.icon img { display: block; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .72)); }
.icon.hd-icon img { image-rendering: auto; }   /* ไอคอน HD วาดมือ (client/assets/items/hd) ย่อแบบเนียน */

/* ---------- ทูลทิป ---------- */
.tooltip {
  pointer-events: none; position: absolute; width: 230px; background: rgba(10, 14, 26, 0.97); border: 1px solid #4a6490;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.5; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.tooltip.pinned { pointer-events: auto; border-color: var(--gold); }
.tooltip { overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
/* ปุ่มของทูลทิปติดล่างเสมอ แม้เนื้อหายาวจนต้องเลื่อน */
.tooltip .tip-actions { position: sticky; bottom: -10px; margin: 8px -12px -10px; padding: 8px 12px 10px; background: rgba(18, 22, 46, 0.98); border-top: 1px solid rgba(170, 190, 255, 0.2); }
.tip-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.tip-name { font-weight: 600; font-size: 14px; }
.tip-kind, .tip-dim { color: var(--ink-dim); font-size: 12px; }
.tip-req { font-size: 12px; }
.tip-stats { margin: 4px 0; }
.tip-compare { margin: 6px 0 2px; padding-top: 6px; border-top: 1px dashed rgba(255, 255, 255, 0.15); font-size: 12.5px; }
.cmp-slot { color: var(--gold); font-weight: 700; margin-bottom: 4px; }
.cmp-note { color: #ffb347; margin-bottom: 4px; }
.vip-box .vip-left { color: #ffe27a; font-weight: 700; }
.vip-box.soon { border-color: #ffb347; box-shadow: 0 0 0 1px rgba(255, 179, 71, 0.5); }
.vip-box .btn { margin-top: 4px; }
.slot-cover { position: absolute; left: 0; right: 0; bottom: 1px; font-size: 9px; line-height: 1.2; text-align: center; color: #ffe2a0; background: rgba(0, 0, 0, 0.55); border-radius: 0 0 6px 6px; }
.cmp-visual { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cmp-box { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cmp-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); }
.cmp-box.empty .cmp-icon { border-style: dashed; color: var(--ink-dim); font-size: 10px; text-align: center; line-height: 1.1; }
.cmp-label { font-size: 11px; color: var(--ink-dim); }
.cmp-arrow { color: var(--gold); font-size: 16px; padding-bottom: 14px; }
.doll-slot.cmp-target .slot-cell { outline: 2px solid var(--gold); outline-offset: 2px; animation: cmp-pulse 1s ease-in-out infinite; }
@keyframes cmp-pulse { 50% { outline-color: rgba(255, 210, 90, 0.25); } }
.tip-lines { margin: 2px 0 4px; }
.tip-desc { color: #cfd8ea; margin: 6px 0 2px; font-size: 12px; }
.tip-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

/* ---------- หุ่นอุปกรณ์ ---------- */
.doll {
  position: relative; display: grid; grid-template-columns: repeat(4, 44px); grid-template-rows: repeat(4, 44px); gap: 6px 14px;
  justify-content: center; padding: 4px 0;
}
.doll-figure {
  grid-column: 2 / 4; grid-row: 1 / 5; background: url('/assets/novice.png') center / 170px no-repeat; image-rendering: pixelated;
  border-radius: 12px; background-color: rgba(0, 0, 0, 0.2);
}
.doll-slot { display: grid; place-items: center; }
.doll-slot .slot-cell { width: 44px; height: 44px; }
.ds-hat { grid-area: 1 / 1; } .ds-necklace { grid-area: 2 / 1; } .ds-cape { grid-area: 3 / 1; } .ds-gloves { grid-area: 4 / 1; }
.ds-top { grid-area: 1 / 4; } .ds-weapon { grid-area: 2 / 4; } .ds-bottom { grid-area: 3 / 4; } .ds-shoes { grid-area: 4 / 4; }
.ds-ring1 { grid-area: 5 / 2; } .ds-ring2 { grid-area: 5 / 3; } .ds-shield { grid-area: 5 / 4; }
.dc-hat { grid-area: 1 / 1; } .dc-cape { grid-area: 2 / 1; } .dc-weapon { grid-area: 3 / 1; }
.dc-top { grid-area: 1 / 4; } .dc-bottom { grid-area: 2 / 4; } .dc-shoes { grid-area: 3 / 4; }
.doll:has(.ds-ring1) { grid-template-rows: repeat(5, 44px); }

/* ---------- สเตตัส ---------- */
.stat-card { background: rgba(0, 0, 0, 0.25); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.stat-row { display: flex; justify-content: space-between; padding: 1px 0; }
.stat-row span { color: var(--ink-dim); }
.ap-head { display: flex; justify-content: space-between; font-size: 13px; margin-top: 2px; }
.ap-left { color: var(--gold); }
.ap-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 6px 8px; }
.ap-name { font-size: 14px; }
.ap-row .gear { color: var(--green); font-size: 12px; }
.progress { height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 999px; overflow: hidden; margin: 4px 0; }
.progress > div { height: 100%; background: var(--green); border-radius: 999px; }
.progress.big { height: 10px; }
.progress.big > div { background: var(--gold); }

/* ---------- แผนที่โลก ---------- */
.win-world { width: min(920px, calc(100vw - 24px)); }
/* แผนที่โลกแบบภาพวาด (client/worldmap.ts) */
.wm { position: relative; line-height: 0; }
.wm-svg { width: 100%; height: auto; max-height: min(56vh, 520px); display: block; font-family: var(--display); object-fit: contain; }
.wm-grid { stroke: #fff; stroke-opacity: 0.28; stroke-width: 1; }
.wm-wave { fill: none; stroke: #fff; stroke-opacity: 0.6; stroke-width: 1.6; stroke-linecap: round; }
.wm-compass text { font-size: 13px; font-weight: 700; fill: #6a4a2a; }
.wm-title text { font-size: 14px; font-weight: 800; fill: #fff4d8; stroke: #102944; stroke-width: 2px; paint-order: stroke; letter-spacing: .3px; }
.wm-route { fill: none; stroke: #7a5a3a; stroke-width: 2; stroke-dasharray: 3 6; stroke-opacity: 0.5; }
.wm-route.open { stroke: #fff; stroke-width: 3; stroke-dasharray: 10 7; stroke-opacity: 0.9; animation: wflow 1.4s linear infinite; filter: drop-shadow(0 0 2px rgba(60, 40, 10, 0.6)); }
.wm-path { stroke: #fff; stroke-width: 2.5; stroke-dasharray: 2 5; stroke-linecap: round; opacity: 0.9; }
.wm-path.gated { stroke: #ffcf68; stroke-dasharray: 2 4; opacity: 0.9; }
.wm-city-route { fill: none; stroke: #ffe28a; stroke-width: 2.5; stroke-dasharray: 5 5; stroke-linecap: round; opacity: 0.9; pointer-events: stroke; filter: drop-shadow(0 1px 1px rgba(70, 42, 12, 0.65)); animation: wflow 2.2s linear infinite; }
.wm-city-route.gated { stroke: #ff9d83; stroke-dasharray: 3 5; opacity: 0.75; }
.wm-city-route:hover { stroke-width: 4; opacity: 1; }
.wm-plaque { cursor: pointer; }
.wm-label.future .wm-plaque { cursor: default; opacity: 0.85; }
.wm-label.here .wm-plaque { filter: drop-shadow(0 0 5px #ff75a8); }
.wm-current-mark { fill: #ff6aa8; stroke: #7c2547; stroke-width: 2; }
.wm-pl-title { font-size: 15px; font-weight: 700; fill: #fff8e0; stroke: #3a1a00; stroke-width: 3.5px; paint-order: stroke; }
.wm-pl-sub { font-size: 10.5px; font-weight: 700; fill: #d9eaff; }
.wm-label:not(.future):hover .wm-plaque { filter: brightness(1.15) drop-shadow(0 0 6px #ffe07a); }
.wm-qmark text { font-size: 14px; font-weight: 800; fill: #3a2000; }
.world-sky, .island-board { position: relative; height: 320px; border-radius: 16px; overflow: hidden; }
.world-sky {
  background: radial-gradient(circle at 82% 18%, rgba(255, 244, 200, 0.95) 0 5%, rgba(255, 230, 160, 0.35) 12%, transparent 30%),
    linear-gradient(180deg, #6ab8ee 0%, #9ad4f4 55%, #d8eefa 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.wcloud {
  position: absolute; left: -30%; width: 110px; height: 34px; border-radius: 99px; background: #fff; opacity: 0.75; transform: scale(var(--s));
  box-shadow: 30px -12px 0 6px #fff, 62px 2px 0 0 #fff; animation: wdrift linear infinite;
}
@keyframes wdrift { to { left: 120%; } }
.routes { position: absolute; inset: 0; width: 100%; height: 100%; }
.route { fill: none; stroke: rgba(255, 255, 255, 0.45); stroke-width: 1.4; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.route.open { stroke: #fff; stroke-width: 2.4; stroke-dasharray: 6 5; animation: wflow 1.2s linear infinite; filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.8)); }
@keyframes wflow { to { stroke-dashoffset: -22; } }
.island {
  position: absolute; transform: translate(-50%, -50%); background: none; border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0;
  color: #fff; z-index: 2;
}
.isle-art { display: block; line-height: 0; filter: drop-shadow(0 8px 6px rgba(20, 40, 80, 0.3)); transition: transform 0.15s; }
.island:hover .isle-art, .island:focus-visible .isle-art { transform: scale(1.1); }
.island.locked .isle-art { filter: grayscale(0.6) brightness(0.85) blur(0.6px); }
.island.locked::after {
  content: '🔒'; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); font-size: 18px; width: 110px; height: 60px; display: grid; place-items: center;
  background: radial-gradient(ellipse, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.35) 55%, transparent 72%);
}
.island.here .isle-art { filter: drop-shadow(0 0 10px #ffe07a) drop-shadow(0 8px 6px rgba(20, 40, 80, 0.3)); }
.here-pin {
  position: absolute; top: -18px; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 99px; white-space: nowrap;
  background: linear-gradient(180deg, #ff9ec8, #e8508a); box-shadow: 0 2px 0 #a8305a;
}
.island-name { font-size: 12.5px; font-weight: 700; margin-top: -2px; padding: 1px 8px; border-radius: 99px; background: rgba(20, 30, 60, 0.7); white-space: nowrap; }
.island-lv { font-size: 10px; font-weight: 600; color: #1a2a40; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); white-space: nowrap; }
.island:hover .island-name, .island:focus-visible .island-name { background: linear-gradient(180deg, #ffe07a, #f5b83c); color: #4a2e00; }
.isle-card {
  position: absolute; z-index: 5; width: 200px; padding: 10px 12px; border-radius: 14px; font-size: 12px; line-height: 1.5; pointer-events: none;
  background: linear-gradient(180deg, rgba(40, 50, 92, 0.97), rgba(24, 30, 60, 0.97)); border: 1.5px solid rgba(170, 190, 255, 0.4); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}
.isle-card[hidden] { display: none; }
.isle-card-name { font-family: var(--display); font-size: 16px; color: var(--c); }
.isle-card-row { display: flex; gap: 4px; margin: 2px 0 4px; }
.isle-card-q { display: flex; gap: 10px; margin: 4px 0; font-weight: 600; color: #ffe07a; }
.world-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; font-size: 11px; color: var(--ink-dim); }
.world-legend span { display: inline-flex; align-items: center; gap: 5px; }
.world-here { color: #ff8bb6; }
.world-legend i { display: inline-block; }
.lg-route { width: 18px; border-top: 2px dashed #fff; }
.lg-city-route { width: 18px; border-top: 2px dashed #e9ad42; }
.lg-here { width: 10px; height: 10px; border-radius: 50%; background: #e8508a; }
.lg-fog { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(#fff, rgba(255, 255, 255, 0.2)); }
.airship { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35)); }

/* แผนที่ในเกาะ */
.island-board { height: 238px; flex: 0 0 238px; background: linear-gradient(180deg, #d7effb, #f3f8fa); border: 1px solid rgba(255, 255, 255, 0.8); border-radius: 14px; box-shadow: inset 0 0 24px rgba(40, 100, 140, 0.1), 0 4px 12px rgba(20, 45, 80, 0.14); }
.routes.solid .route, .routes.solid line { stroke: #fff; stroke-width: 5; stroke-dasharray: none; stroke-linecap: round; filter: drop-shadow(0 2px 0 rgba(40, 70, 110, 0.35)); }
.routes.solid line.gated { stroke: #ffd28a; stroke-dasharray: 8 6; }
.map-route-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px 12px; margin: -3px 2px 2px; font-size: 11px; color: var(--ink-dim); }
.map-route-legend span { display: inline-flex; align-items: center; gap: 5px; }
.route-sample { width: 22px; border-top: 3px solid #fff; filter: drop-shadow(0 1px 1px rgba(20, 50, 80, 0.4)); }
.route-sample.gated { border-top-color: #e5a344; border-top-style: dashed; }
.island-info { background: var(--card); border-radius: 12px; padding: 6px 10px; }
.island-subtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.locked-island { text-align: center; color: var(--ink-dim); padding: 30px 0; }
.locked-island .lock { font-size: 36px; }
.map-node {
  position: absolute; transform: translate(-50%, -50%); background: none; border: 0; cursor: pointer; display: grid; place-items: center; color: #1a2a40; z-index: 2; padding: 5px;
}
.map-node .dot {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; color: #fff; font-weight: 700;
  background: linear-gradient(180deg, #7ad06a, #3f8a2e); border: 2.5px solid #fff; box-shadow: 0 3px 0 rgba(30, 60, 30, 0.45); transition: transform 0.12s;
}
.map-node:hover .dot, .map-node:focus-visible .dot { transform: translateY(-2px) scale(1.12); outline: 2px solid #ffe07a; outline-offset: 2px; }
.map-node.town .dot { background: linear-gradient(180deg, #ffe07a, #f5a83c); color: #5a3000; }
.map-node.boss .dot { background: linear-gradient(180deg, #ff8a8a, #c8303a); }
.map-node.here .dot { animation: here 1s ease-in-out infinite alternate; }
.map-node.sel .dot { outline: 3px solid #ffe07a; outline-offset: 2px; transform: scale(1.08); }
.node-label { position: absolute; top: calc(100% + 2px); left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 1px; width: max-content; max-width: 126px; padding: 3px 7px; border: 1px solid rgba(41, 76, 104, .15); border-radius: 8px; background: rgba(255, 255, 255, .92); color: #18334c; box-shadow: 0 2px 5px rgba(26, 51, 73, .12); line-height: 1.15; white-space: normal; pointer-events: none; }
.node-label b { font-size: 10px; font-weight: 800; }
.node-label small { font-size: 9px; color: #5d7182; }
.map-node.label-above .node-label { top: auto; bottom: calc(100% + 2px); }
.map-node.sel .node-label { border-color: #dda83f; background: #fff3c5; }
@keyframes here { to { box-shadow: 0 3px 0 rgba(30, 60, 30, 0.45), 0 0 0 7px rgba(255, 158, 200, 0.6); } }
.map-detail { display: grid; gap: 5px; background: var(--card); border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 12px; padding: 8px 10px; font-size: 12px; line-height: 1.35; max-height: 130px; overflow-y: auto; }
.map-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.map-detail-name { min-width: 0; font-weight: 800; color: var(--gold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-detail-level { flex: 0 0 auto; color: var(--ink-dim); font-size: 11px; }
.map-chips, .map-chip-list { display: flex; flex-wrap: wrap; gap: 4px; }
.map-chip { display: inline-flex; align-items: center; border: 0; border-radius: 99px; padding: 3px 8px; color: #dce8fa; background: rgba(255, 255, 255, 0.08); font: inherit; font-size: 10px; }
.map-chip.town { color: #553700; background: #ffdc82; }
.map-chip.route { color: #164865; background: #d8f1ff; }
.map-chip.route:hover { background: #fff0af; transform: translateY(-1px); }
.map-chip.gated { color: #704514; background: #ffe0a3; }
.map-route-info { display: grid; gap: 3px; margin-top: 2px; padding-top: 5px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.map-route-info b { color: var(--gold); font-size: 10px; }
.map-mob-info { display: grid; gap: 2px; font-size: 11px; color: var(--ink-dim); }
.map-mob-info b { color: #ffd66e; font-size: 11px; }
.map-route-line { color: var(--ink-dim); font-size: 10px; overflow-wrap: anywhere; }
.boss-line { color: #ffadad; }

/* ---------- ร้าน / ตีบวก ---------- */
.item-row .slot-cell { flex-shrink: 0; cursor: default; }
.price { color: var(--gold); font-size: 12px; }
.enh { display: grid; grid-template-columns: 1fr 1.1fr; gap: 12px; }
.enh-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.enh-pick {
  display: flex; gap: 8px; align-items: center; text-align: left; background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent; border-radius: 8px; padding: 5px 8px; cursor: pointer; font-size: 13px;
}
.enh-pick.sel { border-color: var(--gold); background: rgba(245, 200, 60, 0.1); }
.enh-pick .tag { margin-left: auto; font-size: 10px; color: var(--ink-dim); }
.enh-panel { display: flex; flex-direction: column; gap: 6px; }
.enh-target { display: flex; gap: 10px; align-items: center; }
.enh-rate { display: flex; justify-content: space-between; font-size: 14px; }
.enh-rate b { color: var(--gold); font-size: 18px; }
.enh-cost { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.enh-tier-head { margin-top: 4px; font-size: 11px; color: var(--ink-dim); }
.enh-tier { font-size: 12px; font-weight: 600; opacity: 0.65; }
.enh-tier.next { opacity: 1; font-weight: 800; }
.tip-enh { font-size: 12px; font-weight: 700; margin-top: 3px; }
/* การ์ดที่ช่างตีเหล็ก: ถอด + ผสม */
.card-unsock, .card-fuse { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.unsock-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 6px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); }
.unsock-row .item-btns { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px; }
.fuse-slots { display: flex; gap: 8px; justify-content: center; }
.fuse-slot { width: 92px; min-height: 120px; display: grid; place-items: center; border-radius: 12px; border: 2px dashed rgba(255, 255, 255, 0.25); color: var(--ink-dim); font-size: 26px; font-weight: 800; background: none; padding: 0; }
.fuse-slot.on { border: none; cursor: pointer; }
.fuse-slot .mcard { width: 92px; }
.fuse-odds { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11.5px; }
.fuse-odds .dim { width: 100%; }
.fuse-odds .boss { color: #ffe07a; font-weight: 700; }
.fuse-grid { max-height: 280px; overflow-y: auto; padding: 6px 4px 2px; }
.fuse-pick { background: none; border: none; padding: 0; cursor: pointer; }
.fuse-pick:disabled { cursor: default; opacity: 0.45; }

/* ---------- สกิล / เลือกสาย ---------- */
.win-skills { width: 340px; }
.skill-group { font-size: 12px; font-weight: 600; color: var(--gold); margin-top: 4px; }
.skill-row { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 7px 9px; }
.skill-row.locked .icon { filter: grayscale(0.8) brightness(0.7); }
.skill-row.passive.locked { opacity: 0.6; }
.skill-row .tag { font-size: 11px; color: var(--ink-dim); white-space: nowrap; }
.skill-row .quick-assign { margin-top: 4px; }
.skill-row .item-name .tag { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); }
.skill-row .item-name .tag.ult { background: linear-gradient(90deg, #b8860b, #e8b040); color: #2a1a00; font-weight: 700; }
.skill-row.ult { box-shadow: inset 0 0 0 1px rgba(232, 176, 64, 0.35); }
.item-desc.bad { color: #ff9a8a; }
.qslot.skill { border-color: #5a78a8; }
.qslot .qty.mp { color: #9ac8ff; }
.jobs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.job-card {
  --c: #fff; display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 12px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 22%, transparent), rgba(255, 255, 255, 0.03));
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
}
.job-card.picked { box-shadow: 0 0 0 2px var(--c); }
.job-name b { color: var(--c); font-size: 16px; }
.job-name span { color: var(--ink-dim); font-size: 12px; }
.job-main { font-size: 12px; }
.job-card p { margin: 0; flex: 1; }
.job-skills { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.job-skills span { display: flex; gap: 5px; align-items: center; }

/* ---------- คีย์ลัด ---------- */
.keys { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.key-row { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; }
kbd { background: #24385a; border: 1px solid var(--panel-edge); border-bottom-width: 3px; border-radius: 6px; padding: 1px 6px; font-family: inherit; font-size: 12px; text-align: center; }

/* ---------- HUD: ปุ่มเมนูไอคอน / ตัวติดตามเควส / ปุ่มลัด ---------- */
.menubar { position: absolute; top: 38px; right: 10px; display: flex; gap: 4px; pointer-events: auto; }
.mbtn {
  position: relative; width: 42px; height: 42px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: rgba(15, 22, 38, 0.78); border: 1px solid #2c3e5c; border-radius: 10px; cursor: pointer; color: #dfe6f5; padding: 0;
}
.mbtn:hover { border-color: var(--gold); color: var(--gold); }
.mbtn.on { background: #2e4770; border-color: #5a78a8; }
.mlabel { font-size: 9px; line-height: 1; color: var(--ink-dim); }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: #e8503c; color: #fff; font-size: 11px; font-weight: 600; line-height: 17px; box-shadow: 0 0 0 2px #0f1626;
  animation: pop 1.2s ease-in-out infinite;
}
@keyframes pop { 50% { transform: scale(1.15); } }

.tracker { position: absolute; left: 6px; top: 120px; width: 214px; display: flex; flex-direction: column; gap: 4px; pointer-events: auto; }
.tracker[hidden] { display: none; }
.tracker-head {
  display: flex; justify-content: space-between; background: rgba(15, 22, 38, 0.72); border: 0; border-radius: 8px;
  padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--gold); cursor: pointer;
}
.track {
  text-align: left; background: rgba(15, 22, 38, 0.66); border: 1px solid transparent; border-left: 3px solid #5a78a8;
  border-radius: 8px; padding: 5px 8px; cursor: pointer; font-size: 12px; line-height: 1.35;
}
.track:hover { background: rgba(15, 22, 38, 0.85); }
.track.on { border-color: rgba(255, 216, 74, 0.6); border-left-color: var(--gold); }
.track.ready { border-left-color: var(--green); }
.track.new { border-left-color: #e8a03c; }
.track-name { display: flex; gap: 4px; align-items: center; font-weight: 600; }
.track.ready .track-name { color: var(--green); }
.track.new .track-name { color: #ffc070; }
.track.guide { border-left-color: #7aa8e8; cursor: default; opacity: .92; }
.track.guide .track-name { color: #a8c8ff; font-size: 12px; }
.track-name .micon { color: var(--gold); }
.track-name .micon svg { width: 13px; height: 13px; }
.track-goal { color: #dfe6f5; }
.track-where { color: var(--ink-dim); font-size: 11px; }
.micon { display: inline-flex; line-height: 0; }
/* ไกด์สอนเล่น (ui.ts coachStep): รูไฮไลต์ปุ่มที่ต้องกด รอบๆ มืด (เงาใหญ่) + ป้ายบอก · อยู่ใน body เหนือทุกหน้าต่าง กดทะลุได้ */
.coach-hole {
  position: fixed; z-index: 9500; pointer-events: none; border-radius: 10px; border: 2px solid var(--gold);
  box-shadow: 0 0 0 200vmax rgba(4, 8, 18, 0.6), 0 0 18px rgba(255, 216, 74, 0.8); animation: coach-pulse 1.1s ease-in-out infinite;
  transition: left .18s, top .18s, width .18s, height .18s;
}
.coach-hole[hidden], .coach-bubble[hidden] { display: none !important; }   /* !important: .tipmode ตั้ง display:flex ทับ [hidden] (กด "รู้แล้ว" แล้วป้ายไม่หาย) */
@keyframes coach-pulse { 50% { box-shadow: 0 0 0 200vmax rgba(4, 8, 18, 0.6), 0 0 30px rgba(255, 216, 74, 1); border-color: #fff3b0; } }
.coach-bubble {
  position: fixed; z-index: 9501; pointer-events: none; max-width: min(280px, calc(100vw - 16px)); padding: 8px 12px; border-radius: 10px;
  background: #fff6d6; color: #3a2a08; font: 600 13px/1.4 var(--font, sans-serif); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  animation: coach-bob 1.1s ease-in-out infinite;
}
.coach-bubble::before { content: ''; position: absolute; left: calc(var(--arrow-x, 20px) - 6px); top: -6px; border: 6px solid transparent; border-top: 0; border-bottom-color: #fff6d6; }
.coach-bubble.above::before { top: auto; bottom: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: #fff6d6; }
@keyframes coach-bob { 50% { transform: translateY(3px); } }
/* ป้ายแนะนำระบบ (ไม่บังคับ): ไฮไลต์เบาๆ ไม่มืด · ป้ายกดปุ่ม "รู้แล้ว" ได้ */
.coach-hole.soft { box-shadow: 0 0 16px rgba(255, 216, 74, 0.85); animation: coach-glow 1.1s ease-in-out infinite; }
@keyframes coach-glow { 50% { box-shadow: 0 0 26px rgba(255, 216, 74, 1); border-color: #fff3b0; } }
.coach-bubble.tipmode { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: #f0f6ff; color: #13243f; animation: none; }
.coach-bubble.tipmode::before { border-bottom-color: #f0f6ff; }
.coach-bubble.tipmode.above::before { border-bottom-color: transparent; border-top-color: #f0f6ff; }
.coach-bubble.noarrow::before { display: none; }
.coach-ok { flex: none; border: 0; border-radius: 8px; padding: 5px 10px; background: #2f6fd8; color: #fff; font: inherit; font-size: 12px; cursor: pointer; }

.quickbar { position: absolute; right: 8px; bottom: 17px; display: flex; gap: 4px; pointer-events: auto; }
.qslot {
  position: relative; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.45); border: 1px solid #3b5378; border-radius: 8px;
}
.qslot:hover { border-color: var(--gold); }
.qslot.empty { opacity: 0.55; }
.qslot.out .icon { opacity: 0.35; }
.qslot .qkey { position: absolute; left: 3px; top: 0; font-size: 10px; font-weight: 600; color: var(--gold); text-shadow: 0 1px 2px #000; }
.qslot .qty { position: absolute; right: 3px; bottom: 0; font-size: 10px; font-weight: 600; text-shadow: 0 1px 2px #000, 0 0 2px #000; }
.quick-assign { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; width: 100%; font-size: 12px; }
.quick-assign .btn.key { padding: 3px 8px; min-width: 26px; }
.quick-assign .qa-slot { position: relative; width: 32px; height: 32px; min-width: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.quick-assign .qa-slot.empty { opacity: .7; }
.quick-assign .qa-slot:not(.empty) .qa-key { position: absolute; right: 1px; bottom: 0; font-size: 10px; line-height: 1; padding: 1px 2px; border-radius: 3px; background: rgba(0,0,0,.65); color: #fff; }
.dye-row { display: grid; gap: 4px; width: 100%; font-size: 12px; }
.dye-swatches { display: grid; grid-template-columns: repeat(5, 24px); gap: 5px; }
.dye-swatch { width: 24px; height: 24px; border-radius: 6px; border: 2px solid rgba(0, 0, 0, 0.5); cursor: pointer; padding: 0; }
.dye-swatch:hover { border-color: var(--gold); }
.dye-swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--gold); }

/* มือถือ: ปุ่มใหญ่ขึ้น มีชื่อใต้ไอคอน ย้ายตำแหน่งให้พ้นการ์ดสถานะและปุ่มต่อสู้ */
#ui-layer.touch .menubar { top: 6px; right: 6px; }
#ui-layer.touch .mbtn { width: 48px; height: 46px; }
#ui-layer.touch .tracker { top: 168px; width: 200px; }
#ui-layer.touch .quickbar { bottom: 262px; right: 10px; display: grid; grid-template-columns: repeat(5, 40px); }
#ui-layer.touch .qslot { width: 40px; height: 40px; }
#ui-layer.touch .chat { left: 50%; transform: translateX(-50%); bottom: 14px; width: 36%; }
#ui-layer.touch .chat-log { max-height: 42px; }

/* ---------- แชท ---------- */
.chat { position: absolute; left: 8px; bottom: 64px; width: min(340px, 45%); display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.chat-log {
  max-height: 110px; overflow-y: auto; font-size: 12px; line-height: 1.45; padding: 4px 8px; border-radius: 8px;
  background: linear-gradient(transparent, rgba(10, 14, 26, 0.55) 30%); text-shadow: 0 1px 2px #000; scrollbar-width: none;
}
.chat-log:empty { display: none; }
.chat-line b { color: #9ad0ff; }
.chat-line.me b { color: var(--gold); }
.chat-line.party { color: #9cf0ff; }
.chat-line.party b { color: #5ad8f0; }
.chat-line.whisper { color: #ffb8e8; }
.chat-line.whisper b { color: #ff8ad8; }
.chat-line.system { color: #c8ffd0; font-style: italic; }
.chat-row { display: none; gap: 4px; align-items: center; pointer-events: auto; }
.chat.typing .chat-row { display: flex; }
.chat.typing .chat-input { flex: 1; min-width: 0; }
.chat-bar { display: flex; gap: 3px; }
.chat-chip {
  background: rgba(10, 14, 26, 0.92); border: 1px solid #3b5378; border-radius: 8px; padding: 5px 8px; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.chat-chip.party { color: #5ad8f0; border-color: #5ad8f0; }
.emote-picker {
  pointer-events: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px; width: 200px;
  background: rgba(10, 14, 26, 0.95); border: 1px solid #3b5378; border-radius: 10px;
}
.emote-picker[hidden] { display: none; }
.emote { background: #fff; color: #e8506a; font-weight: 700; border: 0; border-radius: 8px; padding: 6px 0; cursor: pointer; }
.emote:hover { transform: scale(1.08); }

/* ---------- ปาร์ตี้ / คำชวน / เมนูผู้เล่น / หน้าต่างสังคม ---------- */
.party-hud { position: absolute; right: 10px; top: 90px; width: 170px; display: flex; flex-direction: column; gap: 4px; pointer-events: auto; }
.party-hud[hidden] { display: none; }
.pmember { background: rgba(15, 22, 38, 0.72); border-radius: 8px; padding: 4px 8px; font-size: 12px; }
.pm-name { display: flex; align-items: baseline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-name .crown { color: var(--gold); }
.progress.hp { height: 5px; margin: 3px 0 1px; }
.progress.hp > div { background: #dc3c3c; }
#ui-layer.touch .party-hud { top: 104px; right: 8px; }

.invites { position: absolute; top: 130px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 250; pointer-events: auto; }
.invite {
  width: 280px; background: var(--panel); border: 1px solid var(--gold); border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: rise 0.18s ease-out; display: flex; flex-direction: column; gap: 6px;
}
.invite-text { font-size: 14px; }
.invite-actions { display: flex; gap: 6px; justify-content: flex-end; }
.invite.report .btn.wide { text-align: left; }

.player-menu {
  position: absolute; pointer-events: auto; min-width: 170px; background: rgba(10, 14, 26, 0.97); border: 1px solid #4a6490;
  border-radius: 10px; padding: 4px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column;
}
.player-menu[hidden] { display: none; }
.pm-head { padding: 6px 8px 4px; font-size: 13px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 2px; white-space: nowrap; }
.pm-item { text-align: left; background: none; border: 0; border-radius: 6px; padding: 7px 10px; font-size: 13px; cursor: pointer; }
.pm-item:hover { background: rgba(255, 255, 255, 0.08); }
.pm-item.warn { color: #ffb0a0; }

.win-social { width: 340px; }
.social-row { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 6px 8px; }
.name-form { display: flex; gap: 6px; }
.field-input {
  flex: 1; min-width: 0; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--panel-edge); border-radius: 8px; padding: 6px 10px; color: var(--ink); font-size: 13px;
}
.field-input:focus { outline: 2px solid var(--gold); border-color: transparent; }
.chat-input {
  pointer-events: auto; background: rgba(10, 14, 26, 0.92); border: 1px solid var(--gold); border-radius: 8px; padding: 6px 10px; font-size: 14px; color: var(--ink);
}
.chat-input:focus { outline: none; }
@keyframes rise { from { opacity: 0; translate: 0 8px; } }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 16px 6px; }
.panel-title { font-family: var(--display); font-size: 19px; color: var(--gold); }
.panel-sub { font-size: 12px; color: var(--ink-dim); }
.panel-body { padding: 4px 16px 8px; overflow-y: auto; }
.speech { font-size: 16px; line-height: 1.65; margin: 4px 0 12px; }
.options { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.option {
  text-align: left; border: 1px solid transparent; background: rgba(255, 255, 255, 0.05); border-radius: 10px; padding: 9px 12px; cursor: pointer;
}
.option:hover { border-color: var(--panel-edge); background: rgba(255, 255, 255, 0.09); }
.option.quest-new { color: var(--gold); }
.option.quest-ready { color: var(--green); font-weight: 600; }
.option.locked { color: var(--ink-dim); }
.actions { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 16px 14px; }
.quest-box { background: rgba(0, 0, 0, 0.25); border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; font-size: 14px; line-height: 1.6; }
.quest-box.ready { outline: 1px solid var(--green); }
.quest-name { font-weight: 600; color: var(--gold); }
.reward { color: var(--green); }
.item-list { display: flex; flex-direction: column; gap: 6px; }
.item-row { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.04); border-radius: 10px; padding: 8px 10px; }
.item-main { flex: 1; min-width: 0; }
.item-name { font-weight: 600; }
.count { color: var(--gold); font-weight: 400; }
.item-desc { font-size: 12px; color: var(--ink-dim); }
.item-btns { display: flex; gap: 6px; flex-shrink: 0; }
.empty { color: var(--ink-dim); text-align: center; padding: 12px 0; }
.panel > .hint { padding: 0 16px 14px; }

.toasts { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(520px, calc(100% - 32px)); z-index: 200; }
.toast {
  background: rgba(12, 18, 32, 0.9); border: 1px solid var(--panel-edge); border-radius: 999px; padding: 7px 16px; font-size: 14px; text-align: center;
  animation: rise 0.2s ease-out; transition: opacity 0.4s;
}
.toast.gain { border-color: #4f9a5a; color: #c8ffd0; }
.toast.error { border-color: #a0524a; color: #ffd0c8; }
.toast.out { opacity: 0; }

/* แถบแจ้งอัปเดตเกม (client/update.ts) · อยู่เหนือหน้าเข้าสู่ระบบและ UI ในเกม แต่ใต้หน้าบังหมุนจอ/เต็มจอ */
.update-bar {
  position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 9000;
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); padding: 6px 6px 6px 16px; font-size: 14px;
  background: var(--panel); border: 1.5px solid var(--gold); border-radius: 999px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  animation: rise 0.2s ease-out;
}
.update-bar[hidden] { display: none; }
.update-bar > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.update-bar .btn { flex-shrink: 0; }

@media (max-width: 520px) {
  #auth { padding: 12px; }
  .auth-card { padding: 22px 16px 18px; }
  .brand-title { font-size: 30px; }
  .slot.filled { grid-template-columns: 64px 1fr; gap: 10px; }
  .slot-avatar, .slot-figure { width: 64px; height: 64px; }
  .slot-actions { grid-column: 1 / -1; }
  .slot-actions .btn.primary { flex: 1; }
  .speech { font-size: 15px; }
}
@media (max-width: 700px) {
  .enh { grid-template-columns: 1fr; }
  .world-sky { height: 260px; }
  .isle-art svg { width: 72px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .panel, .toast, .win { animation: none; }
  .map-node.here .dot { animation: none; }
}

/* ---------- ช่องสัตว์เลี้ยง (แต่งตัว) ---------- */
.dc-pet { grid-area: 4 / 1; }

/* ---------- แชทกิลด์ / โทรโข่ง ---------- */
.chat-line.guild { color: #b8ffb0; }
.chat-line.guild b { color: #7ae07a; }
.chat-line.world { color: #ffe0a0; font-weight: 600; }
.chat-line.world b { color: #ffb040; }
.chat-chip.guild { color: #7ae07a; border-color: #7ae07a; }
.pose-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 2px; }
.emote.pose { background: #e8f0ff; color: #2a3a5a; font-size: 11px; font-weight: 600; padding: 5px 0; }
.emote-picker { width: 260px; }

/* ---------- แบนเนอร์อีเวนต์ (กลางบน) ---------- */
.event-banner { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; pointer-events: auto; z-index: 5; }
.event-banner[hidden] { display: none; }
.event-chip {
  background: rgba(10, 14, 26, 0.85); border: 1px solid var(--c); color: var(--c); border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 700; white-space: nowrap; cursor: help; box-shadow: 0 0 10px color-mix(in srgb, var(--c) 40%, transparent);
}

/* ---------- สมุดสะสม ---------- */
.title-badge { width: 34px; text-align: center; color: var(--c); font-weight: 800; font-size: 13px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
/* การ์ดมอนแบบการ์ดสะสม: กรอบสีตามประเภท · บอส = กรอบทอง */
.mcard {
  --edge: #6ab8ff; --edge2: #2a5a9a;
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 5px 7px; border-radius: 12px; text-align: center;
  background: linear-gradient(180deg, var(--edge), var(--edge2)); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4); color: #fff;
}
.mcard.part-weapon { --edge: #ff8a6a; --edge2: #a8402a; }
.mcard.part-acc { --edge: #8ae07a; --edge2: #3a8a3a; }
.mcard.boss { --edge: #ffe07a; --edge2: #c8901a; }
.mcard.none { filter: grayscale(0.85) brightness(0.7); }
.mcard-name { font-size: 11px; font-weight: 700; line-height: 1.2; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); width: 100%; background: rgba(0, 0, 0, 0.25); border-radius: 7px; padding: 2px 3px; }
.mcard-art {
  position: relative; width: 72px; height: 72px; display: grid; place-items: center; border-radius: 9px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #fff 0 18%, color-mix(in srgb, var(--bg) 55%, #fff) 45%, color-mix(in srgb, var(--bg) 70%, #223) 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55), inset 0 -8px 14px rgba(0, 0, 0, 0.25);
}
.mcard-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }   /* ภาพมอนวาดมือ (client/assets/items/cardart) */
.mcard-lv { position: absolute; left: 3px; bottom: 2px; font-size: 9px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, 0.45); border-radius: 5px; padding: 0 4px; }
.mcard-star { position: absolute; right: 4px; top: 1px; color: #ffe07a; font-size: 13px; text-shadow: 0 1px 2px #000; }
.mcard-part { font-size: 9px; font-weight: 700; letter-spacing: 0.5px; padding: 0 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.85); color: var(--edge2); }
.mcard-bonus { font-size: 10.5px; line-height: 1.3; font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.mcard-count { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 99px; background: linear-gradient(180deg, #ff7a9a, #e8405a); font-size: 11px; font-weight: 800; line-height: 20px; box-shadow: 0 0 0 2px #1a2044; }
.tip-card-art { display: flex; justify-content: center; margin: 6px 0; }
.tip-card-art .mcard { width: 120px; }
/* สมุดการ์ด: การ์ด + โบนัสสมุด + ปุ่มลง/ถอด · ลงแล้วมีกรอบทอง */
.book-cell { display: flex; flex-direction: column; gap: 4px; }
.book-cell > .btn { margin-top: auto; }
.book-cell.in-book .mcard { box-shadow: 0 0 0 2px #ffd060, 0 0 12px rgba(255, 208, 96, 0.45); }
.book-bonus { font-size: 11px; line-height: 1.3; color: var(--ink-dim); min-height: 2.6em; }
.book-cell.in-book .book-bonus { color: #ffe08a; }
.chip.done { border-color: #ffd060; color: #ffe08a; }
/* รูปมอนสำรอง (ยังไม่มีภาพจริง): ภาพมอนเดิมย้อมสีตามชนิด */
.mob-art-fallback { position: relative; background: url('/assets/mob.png') 0 0 / calc(var(--sz) * 12) var(--sz) no-repeat; image-rendering: pixelated; }
.mob-art-fallback::after {
  content: ''; position: absolute; inset: 0; background: var(--tint); mix-blend-mode: multiply;
  -webkit-mask: url('/assets/mob.png') 0 0 / calc(var(--sz) * 12) var(--sz) no-repeat; mask: url('/assets/mob.png') 0 0 / calc(var(--sz) * 12) var(--sz) no-repeat;
}
.sheet-art { flex: none; border-radius: 10px; }

/* ---------- กิลด์ ---------- */
.emblem {
  display: inline-grid; place-items: center; width: var(--sz); height: var(--sz); border-radius: 22%; background: var(--bg); color: var(--fg);
  font-size: calc(var(--sz) * 0.62); line-height: 1; border: 2px solid rgba(255, 255, 255, 0.25); flex: none;
}
.guild-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.guild-buffs { display: grid; gap: 4px; margin: 6px 0; }
.guild-buff { display: flex; align-items: center; gap: 6px; font-size: 12px; background: rgba(255, 255, 255, 0.04); border-radius: 8px; padding: 4px 8px; }
.guild-buff .btn { margin-left: auto; }
.emblem-designer { display: flex; gap: 12px; align-items: center; margin: 8px 0; }
.emblem-row { display: flex; gap: 3px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.emblem-row .dim { width: 44px; font-size: 11px; }
.emblem-opt { width: 22px; height: 22px; border-radius: 6px; border: 1px solid #3b5378; background: rgba(255, 255, 255, 0.06); color: var(--ink); cursor: pointer; font-size: 13px; padding: 0; }
.emblem-opt.on { outline: 2px solid var(--gold); }

/* ---------- ฟอร์มหลายช่อง (กระดานหาปาร์ตี้ / วางขาย) ---------- */
.name-form.wrap { flex-wrap: wrap; align-items: center; margin-top: 6px; }
.field-input.num { flex: none; width: 64px; }
.field-input.num.wide { width: 120px; }
.qty-act { display: flex; align-items: center; gap: 4px; width: 100%; }
select.field-input { flex: none; max-width: 220px; }

/* =====================================================================
   ธีมใหม่: น่ารัก + โมเดิร์น (กระจกคราม มุมมน ปุ่มนูน หัวหน้าต่างมีไอคอน) — ทับสไตล์เดิมด้านบน
   ===================================================================== */
:root {
  --panel: linear-gradient(180deg, rgba(40, 50, 92, 0.96), rgba(24, 30, 60, 0.97));
  --panel-edge: rgba(170, 190, 255, 0.28);
  --card: rgba(255, 255, 255, 0.06);
  --card-hover: rgba(255, 255, 255, 0.11);
  --accent: #ff9ec8;
  --mint: #8ff0d0;
  --radius: 16px;
}
/* ปุ่ม: นูนมีเงาด้านล่าง กดแล้วยุบ */
.btn {
  background: linear-gradient(180deg, #4a5d9a, #34457a); border: 1px solid rgba(190, 205, 255, 0.35);
  box-shadow: 0 3px 0 #1e2850, 0 4px 10px rgba(0, 0, 0, 0.25); font-weight: 500; transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
.btn:hover:not(:disabled) { background: linear-gradient(180deg, #5870b4, #3d5090); filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #1e2850; }
.btn.primary { background: linear-gradient(180deg, #ffe07a, #f5b83c); border-color: #fff0b0; color: #4a2e00; box-shadow: 0 3px 0 #b07a10, 0 4px 12px rgba(245, 184, 60, 0.35); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffe890, #ffc24a); }
.btn.primary:active:not(:disabled) { box-shadow: 0 1px 0 #b07a10; }
.btn.ghost { background: rgba(255, 255, 255, 0.05); box-shadow: none; }
.btn.small { padding: 5px 13px; }
.btn.key { min-width: 28px; }

/* หน้าต่าง: กระจกคราม มุมมนใหญ่ แถบหัวไล่สี */
.win {
  background: var(--panel); border: 1.5px solid var(--panel-edge); border-radius: 20px; overflow: hidden;
  box-shadow: 0 18px 44px rgba(6, 8, 24, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12); backdrop-filter: blur(6px);
}
.win-head { padding: 8px 8px 8px 12px; background: linear-gradient(90deg, rgba(255, 158, 200, 0.22), rgba(143, 240, 208, 0.12) 60%, transparent); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.win-title { display: flex; align-items: center; gap: 7px; color: #fff; font-size: 16px; letter-spacing: 0.3px; }
.win-title .micon { width: 26px; height: 26px; border-radius: 9px; display: inline-grid; place-items: center; background: linear-gradient(180deg, #ffe07a, #f5a83c); color: #5a3000; box-shadow: 0 2px 0 #b07a10; }
.win-title .micon svg { width: 16px; height: 16px; }
.win-head .icon-btn { width: 28px; height: 28px; padding: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.08); color: #fff; font-size: 13px; }
.win-head .icon-btn:hover { background: #ff7a9a; }
.win-body { min-height: 0; padding: 12px 14px 14px; gap: 10px; scrollbar-width: thin; scrollbar-color: rgba(170, 190, 255, 0.35) transparent; }
.win-body::-webkit-scrollbar, .panel-body::-webkit-scrollbar { width: 6px; }
.win-body::-webkit-scrollbar-thumb, .panel-body::-webkit-scrollbar-thumb { background: rgba(170, 190, 255, 0.35); border-radius: 99px; }

/* แท็บแบบเม็ดยา */
.tabs { background: rgba(8, 12, 32, 0.45); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35); padding: 4px; }
.tab { transition: background 0.15s, color 0.15s; font-weight: 500; }
.tab:hover:not(.active) { color: #fff; background: rgba(255, 255, 255, 0.06); }
.tab.active { background: linear-gradient(180deg, #ffe07a, #f5b83c); color: #4a2e00; box-shadow: 0 2px 0 #b07a10; font-weight: 700; }

/* การ์ดรายการ: ลอยขึ้นนิดเมื่อชี้ */
.item-row, .option, .skill-row, .quest-box, .guild-buff { border-radius: 14px; background: var(--card); border: 1px solid rgba(255, 255, 255, 0.05); transition: background 0.15s, transform 0.12s; }
.item-row:hover, .option:hover { background: var(--card-hover); transform: translateY(-1px); }
.slot-cell { border-radius: 10px; }

/* กล่องบทพูด NPC / ทูลทิป / แจ้งเตือน */
.panel { border-radius: 22px; background: var(--panel); border: 1.5px solid var(--panel-edge); box-shadow: 0 18px 44px rgba(6, 8, 24, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.tooltip { border-radius: 14px; background: linear-gradient(180deg, rgba(34, 42, 80, 0.98), rgba(18, 22, 46, 0.98)); border: 1.5px solid rgba(170, 190, 255, 0.35); }
.toast { background: linear-gradient(180deg, rgba(40, 50, 92, 0.95), rgba(24, 30, 60, 0.95)); border: 1.5px solid var(--panel-edge); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
.toast.gain { border-color: var(--mint); }
.toast.error { border-color: #ff8aa0; }

/* แถบเมนูไอคอน: ปุ่มเหลี่ยมมน ลอยขึ้นเมื่อชี้ */
.menubar { gap: 6px; }
.mbtn {
  width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(180deg, rgba(58, 72, 128, 0.92), rgba(30, 38, 76, 0.92));
  border: 1.5px solid rgba(170, 190, 255, 0.3); box-shadow: 0 3px 0 rgba(10, 14, 36, 0.8), 0 6px 14px rgba(0, 0, 0, 0.25); transition: transform 0.12s, border-color 0.15s;
}
.mbtn:hover { transform: translateY(-2px); border-color: #ffe07a; color: #ffe07a; }
.mbtn.on { background: linear-gradient(180deg, #ffe07a, #f5b83c); color: #4a2e00; border-color: #fff0b0; box-shadow: 0 3px 0 #b07a10; }
.mbtn.on .mlabel { color: #5a3a00; }
.badge { background: linear-gradient(180deg, #ff7a9a, #e8405a); box-shadow: 0 0 0 2px #1a2044; }

/* ปุ่มลัด */
.qslot { border-radius: 12px; background: linear-gradient(180deg, rgba(58, 72, 128, 0.85), rgba(24, 30, 60, 0.9)); border: 1.5px solid rgba(170, 190, 255, 0.28); }
.qslot.skill { border-color: rgba(255, 224, 122, 0.45); }
.qslot .skill-icon svg { width: 30px; height: 30px; }

/* เม็ดป้าย / ชิปตัวกรอง */
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; background: rgba(255, 255, 255, 0.1); color: var(--ink); white-space: nowrap; }
.pill.ok { background: rgba(143, 240, 208, 0.18); color: var(--mint); }
.pill.gold { background: linear-gradient(90deg, #f5b83c, #ffe07a); color: #4a2e00; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.05); color: var(--ink-dim); border-radius: 99px; padding: 3px 9px; font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.chip:hover { color: #fff; }
.chip.on { background: linear-gradient(180deg, #ff9ec8, #e87aa8); border-color: #ffc8e0; color: #fff; font-weight: 600; box-shadow: 0 2px 0 #a8406a; }

/* ---------- หน้าต่างสกิลใหม่ ---------- */
.win-skills { width: 384px; }
.sk-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 14px; background: linear-gradient(90deg, color-mix(in srgb, var(--job) 35%, transparent), rgba(255, 255, 255, 0.03)); border: 1px solid color-mix(in srgb, var(--job) 55%, transparent); }
.sk-job { display: flex; align-items: center; gap: 7px; }
.sk-job b { font-family: var(--display); font-size: 16px; font-weight: 500; }
.sk-job .dim { font-size: 12px; }
.sk-job-dot, .sk-tab-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--job); box-shadow: 0 0 8px var(--job); display: inline-block; }
.sk-tab-dot { width: 8px; height: 8px; margin-right: 5px; vertical-align: 1px; }
.sk-sp { display: flex; align-items: baseline; gap: 5px; padding: 3px 12px; border-radius: 99px; background: rgba(0, 0, 0, 0.3); font-size: 12px; color: var(--ink-dim); }
.sk-sp b { font-size: 17px; color: var(--ink); }
.sk-sp.has { background: linear-gradient(180deg, #ffe07a, #f5b83c); color: #5a3a00; box-shadow: 0 2px 0 #b07a10; animation: pop 1.6s ease-in-out infinite; }
.sk-sp.has b { color: #4a2e00; }
.sk-tabs .tab.active { background: linear-gradient(180deg, color-mix(in srgb, var(--job) 70%, #fff), var(--job)); color: #1a1030; box-shadow: 0 2px 0 color-mix(in srgb, var(--job) 60%, #000); }
.sk-role { font-size: 12px; line-height: 1.5; }
.sk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sk-cell {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; border-radius: 14px; cursor: pointer;
  background: var(--card); border: 1.5px solid rgba(255, 255, 255, 0.06); color: var(--ink); transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.sk-cell:hover { transform: translateY(-2px); background: var(--card-hover); }
.sk-cell.sel { border-color: #ffe07a; background: rgba(255, 224, 122, 0.12); box-shadow: 0 0 0 3px rgba(255, 224, 122, 0.15); }
.sk-cell.unlearned .skill-icon { filter: saturate(0.35) brightness(0.8); }
.sk-cell.locked .skill-icon { filter: grayscale(1) brightness(0.55); }
.sk-cell.ult:not(.locked) { background: linear-gradient(180deg, rgba(255, 210, 74, 0.14), rgba(255, 255, 255, 0.04)); }
.sk-name { font-size: 11px; line-height: 1.2; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-lvbar { width: 80%; height: 4px; border-radius: 99px; background: rgba(0, 0, 0, 0.35); overflow: hidden; }
.sk-lvbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), #ffe07a); border-radius: 99px; }
.sk-up { position: absolute; top: 3px; right: 5px; width: 17px; height: 17px; border-radius: 50%; background: linear-gradient(180deg, #ffe07a, #f5b83c); color: #4a2e00; font-weight: 800; font-size: 13px; line-height: 17px; box-shadow: 0 1px 0 #b07a10; }
.sk-lock { position: absolute; top: 20px; font-size: 16px; filter: drop-shadow(0 1px 1px #000); }
.sk-detail { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; background: linear-gradient(180deg, color-mix(in srgb, var(--job) 18%, rgba(255, 255, 255, 0.05)), rgba(255, 255, 255, 0.03)); border: 1.5px solid color-mix(in srgb, var(--job) 45%, transparent); }
.sk-detail.ult { border-color: #ffd24a; }
.sk-detail-top { display: flex; align-items: center; gap: 10px; }
.sk-title { font-family: var(--display); font-size: 17px; }
.sk-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.sk-desc { font-size: 13px; line-height: 1.55; color: #e4e9f8; }
.sk-aug { display: flex; flex-direction: column; gap: 3px; font-size: 12px; line-height: 1.45; padding: 6px 8px; border-radius: 8px; background: rgba(255, 208, 112, .08); border: 1px solid rgba(255, 208, 112, .25); }
.sk-aug b { color: #ffd070; }
.sk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 6px; }
.sk-stat { display: flex; flex-direction: column; align-items: center; padding: 5px 4px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); font-size: 11px; }
.sk-stat b { font-size: 14px; color: #ffe07a; }
.sk-basic { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 14px; background: var(--card); }
.sk-basic.locked { opacity: 0.55; }
.sk-basic-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: linear-gradient(135deg, #8a9ad8, #4a5a9a); flex: none; }
.job-skills .skill-icon svg { width: 20px; height: 20px; }

/* ---------- ระบบการ์ด / อุปกรณ์แบบ MapleStory (ไม่มีขอบสีความหายาก) ---------- */
.slot-cell .slot-dots { position: absolute; left: 3px; bottom: 0; font-size: 8px; letter-spacing: -1px; color: #8ac8ff; text-shadow: 0 1px 2px #000; }
.slot-cell.is-card { background: linear-gradient(145deg, #20242b, #14171d); border-color: #414854; }
.var-up { color: #8ac8ff; }
.var-down { color: #ff8a8a; }
.tip-cards { display: grid; gap: 3px; margin: 6px 0 4px; }
.tip-card { display: flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 7px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: var(--ink-dim); border: 1px dashed rgba(170, 190, 255, 0.3); }
.tip-card.on { color: #ffd070; border: 1px solid rgba(255, 208, 112, 0.5); background: rgba(255, 208, 112, 0.1); }
.card-bonus { color: #ffd070; font-weight: 600; }
.btn.wide.small { text-align: left; }

/* ---------- หน้าต่างแลกของ ---------- */
.win-xtrade { width: 440px; }
.xt { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.xt-side { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 14px; background: var(--card); border: 1.5px solid rgba(255, 255, 255, 0.08); transition: border-color 0.2s, background 0.2s; }
.xt-side.locked { border-color: rgba(255, 224, 122, 0.6); background: rgba(255, 224, 122, 0.08); }
.xt-side.ok { border-color: var(--mint); background: rgba(143, 240, 208, 0.1); }
.xt-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.xt-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xt-grid { display: grid; grid-template-columns: repeat(4, 40px); gap: 4px; justify-content: center; }
.xt-shell { display: flex; align-items: center; gap: 6px; justify-content: center; }
.xt-shell .field-input.num { width: 110px; }
.xt-actions { padding: 0; }

/* ---------- จดหมาย ---------- */
.win-mail { width: 380px; }
.mail-row { border-radius: 14px; background: var(--card); border: 1px solid rgba(255, 255, 255, 0.05); overflow: hidden; }
.mail-row.unread { border-color: rgba(255, 158, 200, 0.55); background: rgba(255, 158, 200, 0.08); }
.mail-top { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; background: none; border: 0; text-align: left; cursor: pointer; color: inherit; }
.mail-top:hover { background: rgba(255, 255, 255, 0.05); }
.mail-top .item-name { display: flex; gap: 6px; align-items: center; }
.mail-top .item-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-ic { font-size: 20px; flex: none; }
.mail-at { font-size: 11px; flex: none; }
.mail-body { padding: 0 12px 6px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.mail-attach { display: flex; align-items: center; gap: 8px; margin: 0 12px 6px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 224, 122, 0.1); border: 1px dashed rgba(255, 224, 122, 0.5); font-size: 13px; }
.mail-row .item-btns { padding: 0 12px 10px; justify-content: flex-end; }
.mail-form { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; }
.mail-text { min-height: 64px; resize: vertical; font: inherit; }
.mail-pick { display: flex; gap: 6px; }
.mail-pick select { flex: 1; min-width: 0; }

/* ---------- ตั้งค่าเสียง (เมนู) ---------- */
.sound-box { display: grid; gap: 6px; padding: 10px 12px; border-radius: 14px; background: var(--card); margin-bottom: 8px; }
.sound-head { display: flex; justify-content: space-between; align-items: center; }
.vol-row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.vol-row input[type=range] { accent-color: #ffd24a; width: 100%; }
.vol-row .mob-vol { display: flex; align-items: center; gap: 6px; min-width: 0; }
.vol-row .mob-vol input[type=range] { flex: 1; min-width: 0; }
.vol-row .mob-vol input[type=range]:disabled { opacity: 0.4; }

/* ---------- แถบเมนู: ปุ่มกระจกสีเข้ม ไอคอนเส้น · สีประจำปุ่มขึ้นเฉพาะตอนชี้/เปิดหน้าต่างอยู่ ---------- */
.mbtn {
  --c: #9ab8ff;
  width: 44px; height: 44px; border-radius: 12px; color: #e4eaf8;
  background: linear-gradient(180deg, rgba(40, 52, 92, 0.82), rgba(18, 24, 46, 0.86));
  border: 1px solid rgba(170, 190, 255, 0.22); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.12s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.mbtn::after { /* เส้นสีประจำปุ่มใต้ไอคอน */
  content: ''; position: absolute; left: 50%; bottom: 3px; width: 14px; height: 2px; border-radius: 2px; transform: translateX(-50%);
  background: var(--c); opacity: 0.55; transition: width 0.15s, opacity 0.15s;
}
.mbtn:hover { transform: translateY(-1px); color: var(--c); border-color: color-mix(in srgb, var(--c) 60%, transparent); }
.mbtn:hover::after { width: 22px; opacity: 1; }
.mbtn.on { color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 45%, #1e2a50), color-mix(in srgb, var(--c) 20%, #141a33)); border-color: color-mix(in srgb, var(--c) 75%, transparent); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 45%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
.mbtn.on::after { width: 22px; opacity: 1; }
.mbtn .mlabel { font-size: 9px; color: rgba(220, 228, 245, 0.62); }
.mbtn.on .mlabel { color: rgba(255, 255, 255, 0.85); }
.mbtn .badge { box-shadow: 0 0 0 2px #141a33; }
.mbtn.t-bag { --c: #ffb35c; }
.mbtn.t-equip { --c: #6fb2ff; }
.mbtn.t-stats { --c: #7be3a8; }
.mbtn.t-skills { --c: #c79bff; }
.mbtn.t-quest { --c: #ffd86b; }
.mbtn.t-world { --c: #5fd6e8; }
.mbtn.t-social { --c: #ff9ccb; }
.mbtn.t-book { --c: #b4a2ff; }
.mbtn.t-mail { --c: #ff8f8f; }
.mbtn.t-menu { --c: #c9d3ea; }
.mbtn.t-sit { --c: #ffc98a; }
.mbtn.t-chat { --c: #9fd9ff; }

/* ---------- มือถือ: การ์ดสถานะซ้ายบน (Phaser) · จอยซ้ายล่าง · ปุ่มฟัน + ปุ่มลัดกลมเรียงโค้งขวาล่าง ---------- */
/* คอมใช้แถบสถานะล่าง + ปุ่มลัดเรียงแถวแบบเดิม (ไม่มีแผงปุ่มแอ็กชัน) */
#ui-layer.touch .tracker { top: calc(var(--game-px, 1) * 188px); }   /* ใต้มินิแมพพอดี (Phaser วาดถึงพิกัดเกม y≈182) */
#ui-layer.touch .party-hud { top: 100px; }
#ui-layer.touch .chat { bottom: 70px; }

.action-pad { position: absolute; right: 0; bottom: 0; width: 0; height: 0; pointer-events: none; }
.act {
  --c: #9ab8ff;
  position: absolute; display: grid; place-items: center; border-radius: 50%; padding: 0; cursor: pointer; pointer-events: auto; touch-action: none; color: #fff;
  background: radial-gradient(circle at 50% 35%, rgba(60, 74, 120, 0.62), rgba(14, 20, 40, 0.7));
  border: 2px solid rgba(255, 255, 255, 0.35); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent);
  transition: transform 0.08s, background 0.1s, border-color 0.1s;
}
.act.down, .act:active { transform: scale(0.93); border-color: var(--c); background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 45%, #2a3660), rgba(14, 20, 40, 0.8)); }
.act-ico { line-height: 0; }
.act-ico svg { width: 100%; height: 100%; }
.act-name {
  position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); padding: 0 6px; border-radius: 99px; white-space: nowrap;
  background: rgba(14, 20, 40, 0.8); color: rgba(255, 255, 255, 0.9); font-size: 9px; line-height: 1.5;
}
.act.atk { --c: #ff8a6a; width: 92px; height: 92px; right: 28px; bottom: 28px; border-width: 3px; border-color: rgba(255, 170, 140, 0.6); }
.act.atk .act-ico { width: 46px; height: 46px; }
.act.jump { --c: #6fb2ff; width: 62px; height: 62px; right: 218px; bottom: 14px; }
.act.jump .act-ico { width: 30px; height: 30px; }
.act.pick { --c: #ffd86b; width: 52px; height: 52px; right: 235px; bottom: 96px; }
.act.pick .act-ico { width: 26px; height: 26px; }
.act.talk { --c: #7be3a8; width: 52px; height: 52px; right: 243px; bottom: 168px; border-color: rgba(123, 227, 168, 0.75); animation: talk-bob 1.2s ease-in-out infinite; }
.act.talk .act-ico { width: 26px; height: 26px; }
.act.talk[hidden] { display: none; }
@keyframes talk-bob { 50% { translate: 0 -3px; } }

#ui-layer.touch .quickbar { position: absolute; right: 0; bottom: 0; width: 0; height: 0; display: block; pointer-events: none; }
#ui-layer.touch .quickbar .qslot {
  position: absolute; width: 48px; height: 48px; border-radius: 50%; pointer-events: auto; display: grid; place-items: center; padding: 0;
  background: radial-gradient(circle at 50% 35%, rgba(60, 74, 120, 0.62), rgba(14, 20, 40, 0.72)); border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
}
#ui-layer.touch .quickbar .qslot.skill { border-color: rgba(200, 170, 255, 0.6); }
#ui-layer.touch .quickbar .qslot.empty { opacity: 0.55; border-style: dashed; }
#ui-layer.touch .quickbar .qslot:active { transform: scale(0.93); }
#ui-layer.touch .quickbar .qslot .qkey { left: 50%; top: auto; bottom: -6px; transform: translateX(-50%); padding: 0 4px; border-radius: 99px; background: rgba(14, 20, 40, 0.85); color: var(--gold); font-size: 9px; }
#ui-layer.touch .quickbar .qslot .qty { right: -2px; bottom: auto; top: -4px; padding: 0 4px; border-radius: 99px; background: rgba(14, 20, 40, 0.85); font-size: 9px; }
#ui-layer.touch .quickbar .qslot:nth-child(1) { right: 157px; bottom: 50px; }
#ui-layer.touch .quickbar .qslot:nth-child(2) { right: 144px; bottom: 101px; }
#ui-layer.touch .quickbar .qslot:nth-child(3) { right: 109px; bottom: 139px; }
#ui-layer.touch .quickbar .qslot:nth-child(4) { right: 60px; bottom: 157px; }
#ui-layer.touch .quickbar .qslot:nth-child(5) { right: 10px; bottom: 150px; }
#ui-layer.touch .quickbar .qslot:nth-child(n+6) { width: 42px; height: 42px; bottom: 14px; }
#ui-layer.touch .quickbar .qslot:nth-child(6) { right: 500px; }
#ui-layer.touch .quickbar .qslot:nth-child(7) { right: 452px; }
#ui-layer.touch .quickbar .qslot:nth-child(8) { right: 404px; }
#ui-layer.touch .quickbar .qslot:nth-child(9) { right: 356px; }
#ui-layer.touch .quickbar .qslot:nth-child(10) { right: 308px; }
/* มือถือ: แถบเมนูอยู่ขวาของการ์ดสถานะ (game.ts CARD กว้างถึง x=272 + เว้น 8) แถวเดียวเสมอ — จอแคบปุ่มหดลงแทนที่จะทับการ์ด */
#ui-layer.touch .menubar { gap: 3px; right: 6px; left: calc(280px * var(--game-px, 1)); justify-content: flex-end; }
#ui-layer.touch .mbtn { width: 40px; height: 40px; border-radius: 11px; }
#ui-layer.touch .mbtn .mlabel { font-size: 8px; }

/* ---------- ห้องบอส: เลือกระดับ ---------- */
.boss-diff .quest-name { display: flex; align-items: center; gap: 6px; }
.boss-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 6px currentColor; }
.boss-diff .actions { margin-top: 6px; justify-content: space-between; align-items: center; }

/* ---------- แชนแนล ---------- */
.ch-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- ร้านค้าส่วนตัว (ตลาดกลาง) ---------- */
.win-pshop { width: 400px; }
.ps-open { margin-bottom: 8px; }
.ps-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 15px; }
.ps-lines { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.ps-line { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; background: var(--card); border: 1px solid rgba(255, 255, 255, 0.06); }
.ps-line .item-main { flex: 1; min-width: 0; }
.ps-inputs, .ps-buy { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.ps-buy { margin-top: 0; }
.ps-inputs .num, .ps-buy .num { width: 64px; }

/* ---------- จัดอันดับ ---------- */
.win-rank { width: 380px; }
.rank-head { display: flex; gap: 8px; margin: 8px 0; }
.rank-head select { flex: 1; }
.rank-list { display: flex; flex-direction: column; gap: 3px; }
.rank-row { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--card); font-size: 13px; }
.rank-row.me { outline: 2px solid rgba(255, 224, 122, 0.8); }
.rank-row.top1 { background: linear-gradient(90deg, rgba(255, 210, 74, 0.28), var(--card)); }
.rank-row.top2 { background: linear-gradient(90deg, rgba(210, 220, 240, 0.22), var(--card)); }
.rank-row.top3 { background: linear-gradient(90deg, rgba(220, 150, 90, 0.22), var(--card)); }
.rank-no { text-align: center; font-weight: 700; }
.rank-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* /ui (เก็บภาพ): ซ่อนเมนู/HUD ทั้งหมด เหลือแชท (ไว้พิมพ์ /ui กลับ) กับป๊อปอัป · แชทจางจนกว่าจะพิมพ์ */
#ui-layer.hud-hidden > *:not(.chat):not(.toasts) { display: none !important; }
#ui-layer.hud-hidden .chat { opacity: 0; }
#ui-layer.hud-hidden .chat:focus-within { opacity: 1; }

/* ---------- ประกาศจากผู้ดูแล: แถบใหญ่กลางบน ---------- */
.announce-bar {
  position: absolute; left: 50%; top: 96px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 10px;
  max-width: min(640px, calc(100% - 32px)); padding: 10px 18px; pointer-events: auto; cursor: pointer;
  font: 600 16px/1.4 var(--font); color: #fff7dc; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  background: linear-gradient(180deg, rgba(64, 44, 8, 0.95), rgba(36, 24, 4, 0.95)); border: 2px solid var(--gold); border-radius: 14px;
  box-shadow: 0 0 0 3px rgba(245, 200, 60, 0.25), 0 8px 24px rgba(0, 0, 0, 0.5);
}
.announce-bar[hidden] { display: none; }
.announce-icon { font-size: 22px; }
.announce-bar.pop { animation: announce-pop 0.35s ease-out; }
@keyframes announce-pop { from { transform: translateX(-50%) scale(0.9); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
#ui-layer.touch .announce-bar { top: 104px; font-size: 14px; padding: 7px 14px; max-width: max(240px, calc(100% - 480px)); }   /* ไม่ทับป้ายชวนเพื่อน/ติดตามเพจมุมขวา */

/* ---------- ชวนเพื่อน ---------- */
/* ป้ายเด่นใต้ปุ่มเมนู (ขวาบน): รูปโมจิ + ข้อความ + ความคืบหน้า · รายชื่อปาร์ตี้เลื่อนลงไม่ให้ทับ */
.promo-cards { position: absolute; right: 10px; top: 90px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; }
.invite-card {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 6px; pointer-events: auto; cursor: pointer;
  font: inherit; color: #4a2a00; text-align: left; border: 1.5px solid #fff0c0; border-radius: 14px;
  background: linear-gradient(180deg, #ffe89a, #ffb6d0); box-shadow: 0 0 0 2px rgba(255, 200, 120, 0.35), 0 4px 14px rgba(255, 170, 90, 0.45);
  animation: cash-glow 1.8s ease-in-out infinite;
}
.invite-card[hidden] { display: none; }
.invite-card:hover { filter: brightness(1.06); }
.invite-card-pet { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, 0.55); }
.invite-card-text { display: flex; flex-direction: column; line-height: 1.2; }
.invite-card-text b { font-size: 13px; }
.invite-card-text span { font-size: 11px; color: #7a3a4a; font-weight: 600; }
.invite-card-count { margin-left: 2px; padding: 2px 8px; border-radius: 999px; background: #4a2a00; color: #ffe89a; font-size: 12px; font-weight: 700; }
.invite-card.ready { animation-duration: 0.9s; }
#ui-layer.has-invite .party-hud, #ui-layer.has-follow .party-hud { top: 150px; }
#ui-layer.has-invite.has-follow .party-hud { top: 208px; }
/* ติดตามเพจ: สีฟ้า Facebook */
.follow-card { color: #fff; background: linear-gradient(180deg, #4a8cff, #1864e0); border-color: #b8d4ff; box-shadow: 0 0 0 2px rgba(80, 140, 255, 0.35), 0 4px 14px rgba(24, 100, 224, 0.45); animation: none; }
.follow-card .invite-card-text span { color: #dce8ff; }
.follow-card .invite-card-pet { background: rgba(255, 255, 255, 0.85); }
.follow-card.ready { color: #4a2a00; background: linear-gradient(180deg, #ffe89a, #ffb6d0); border-color: #fff0c0; animation: cash-glow 0.9s ease-in-out infinite; }
.follow-card.ready .invite-card-text span { color: #7a3a4a; }
#ui-layer.touch .promo-cards { top: 58px; right: 6px; gap: 4px; }
#ui-layer.touch .invite-card { padding: 3px 8px 3px 4px; }
#ui-layer.touch .invite-card-pet { width: 32px; height: 32px; }
#ui-layer.touch.has-invite .party-hud, #ui-layer.touch.has-follow .party-hud { top: 110px; }
#ui-layer.touch.has-invite.has-follow .party-hud { top: 156px; }

.win-invite { width: min(460px, calc(100% - 8px)); }
.invite-reward { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border-radius: 12px; text-align: center;
  background: linear-gradient(180deg, rgba(255, 210, 74, 0.24), var(--card)); border: 1px solid rgba(255, 224, 122, 0.5); }
.invite-reward p { margin: 0; font-size: 12px; }
.invite-tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 8px; }
.invite-tiers .invite-reward { justify-content: space-between; padding: 10px 8px; }
.invite-tiers .invite-reward-title { font-size: 13px; }
.invite-tiers .invite-reward p { font-size: 11px; }
.invite-reward.can { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 224, 122, 0.45); animation: cash-glow 1.2s ease-in-out infinite; }
.invite-reward.got { opacity: 0.6; filter: saturate(0.6); }
.invite-reward-title { color: var(--gold); font-size: 16px; }
.invite-items { display: flex; align-items: flex-end; justify-content: center; gap: 10px; }
.invite-item { position: relative; display: grid; place-items: center; padding: 6px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); }
.invite-item.main { padding: 8px; background: radial-gradient(circle, rgba(255, 224, 122, 0.35), rgba(0, 0, 0, 0.2) 70%); box-shadow: 0 0 0 2px rgba(255, 224, 122, 0.55); }
.invite-item b { position: absolute; right: 2px; bottom: 0; font-size: 11px; text-shadow: 0 1px 2px #000; }
.invite-gift { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; margin-top: 8px; padding: 8px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.18); font-size: 12px; text-align: center; }
.invite-gift .invite-items { gap: 6px; }
.invite-gift .invite-item.main { padding: 6px; background: rgba(0, 0, 0, 0.22); box-shadow: none; }
.invite-steps { margin: 10px 0 8px; padding-left: 22px; font-size: 13px; color: var(--ink-dim); }
.invite-steps li { margin: 2px 0; }
.invite-row { display: flex; gap: 6px; align-items: center; }
.invite-row .invite-link { flex: 1; min-width: 0; font-size: 12px; }
.share-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.share-btn {
  flex: 1 1 80px; min-height: 34px; padding: 6px 10px; border: 0; border-radius: 10px; cursor: pointer;
  font: 700 13px var(--font); color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}
.share-btn:hover { filter: brightness(1.08); }
.share-btn.line { background: #06c755; }
.share-btn.fb { background: #1877f2; }
.share-btn.msgr { background: linear-gradient(135deg, #0099ff, #a033ff); }
.share-btn.ig { background: linear-gradient(135deg, #feda75, #fa7e1e 30%, #d62976 60%, #962fbf 85%, #4f5bd5); }
.share-btn.more { background: #3b4a6e; }
.invite-progress { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; }
.invite-bar { flex: 1; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.invite-bar span { display: block; height: 100%; border-radius: 5px; background: var(--gold); transition: width 0.3s; }
.invite-list { display: flex; flex-direction: column; gap: 3px; max-height: 170px; overflow-y: auto; flex-shrink: 0; }   /* จอเตี้ย (มือถือแนวนอน): ไม่ให้รายชื่อหดจนหาย ให้หน้าต่างเลื่อนแทน */
.invite-friend { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--card); font-size: 13px; }
.invite-friend > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-friend b { font-size: 12px; color: var(--ink-dim); font-weight: 600; }
.invite-friend.ok b { color: var(--green); }

/* ---------- ความสำเร็จ ---------- */
.ach-sum { margin: 6px 0 10px; font-size: 15px; }
.ach-group { margin: 10px 0 4px; font-size: 12px; font-weight: 700; color: var(--accent, #ffd84a); letter-spacing: .5px; }
.ach-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; background: var(--card); margin-bottom: 4px; opacity: .65; }
.ach-row.done { opacity: 1; border: 1px solid rgba(255, 224, 122, 0.45); background: rgba(255, 224, 122, 0.08); }
.ach-row .item-main { flex: 1; min-width: 0; }
.ach-ic { font-size: 18px; width: 22px; text-align: center; }
.ach-rw { font-size: 11px; white-space: nowrap; }

/* ---------- ปุ่มออโต้ ---------- */
.mbtn.auto-on { background: linear-gradient(180deg, #7ae0a0, #3aa870); color: #0a2a18; box-shadow: 0 0 0 2px rgba(122, 224, 160, 0.6), 0 0 14px rgba(122, 224, 160, 0.55); animation: autoPulse 1.6s ease-in-out infinite; }
@keyframes autoPulse { 50% { box-shadow: 0 0 0 2px rgba(122, 224, 160, 0.9), 0 0 22px rgba(122, 224, 160, 0.8); } }

/* ---------- ตั้งค่าบอท ---------- */
.win-bot { width: 360px; }
.bot-status { margin-bottom: 8px; font-size: 14px; }
.bot-go { gap: 8px; margin-bottom: 4px; }
.bot-opts { display: flex; flex-direction: column; gap: 6px; }
.bot-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.bot-check input { width: 16px; height: 16px; accent-color: #7ae0a0; }
.bot-skill { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 13px; }
.bot-skill.off { opacity: .45; }
.bot-skill input { width: 16px; height: 16px; accent-color: #7ae0a0; }
.bot-skill-n { width: 16px; text-align: right; color: #ffd76a; }
.bot-skill-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-skill button { min-width: 28px; padding: 2px 6px; }
.bot-pet { margin: 10px 0 6px; padding: 8px 10px; border-radius: 12px; font-size: 13px; background: rgba(255, 180, 120, 0.12); border: 1px dashed rgba(255, 180, 120, 0.5); }
.bot-pet.ok { background: rgba(122, 224, 160, 0.12); border-color: rgba(122, 224, 160, 0.5); }
.shop-filter { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 8px; font-size: 12px; }

/* ---------- แชทแบบ MapleStory: ชิดเหนือแถบเลือดล่างซ้าย ---------- */
.chat { left: 0; bottom: 58px; width: min(380px, 40%); gap: 2px; }
.chat-log { max-height: 58px; border-radius: 0 10px 0 0; background: rgba(10, 14, 26, 0.5); padding: 3px 26px 3px 8px; pointer-events: auto; }
.chat:not(.typing):not(.big) .chat-line.stale { display: none; }
.chat.big .chat-log, .chat.typing .chat-log { max-height: 170px; background: rgba(10, 14, 26, 0.72); }
.chat-toggle {
  position: absolute; right: 4px; top: 3px; z-index: 1; pointer-events: auto; cursor: pointer; width: 20px; height: 18px; padding: 0; font-size: 10px; line-height: 1;
  border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(10, 14, 26, 0.8); color: #c9d3ea;
}
.chat-toggle:hover { color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.chat-row { padding: 0 4px 2px; }
/* ขยาย/พิมพ์: ใส่ #ui-layer ให้ชนะกฎความสูงของมือถือ/คอม (เดิมบนมือถือกด ▲ แล้วกล่องไม่สูงขึ้น) · ลากนิ้วเลื่อนดูย้อนหลังได้ */
#ui-layer .chat.big .chat-log, #ui-layer .chat.typing .chat-log { max-height: 170px; background: rgba(10, 14, 26, 0.72); }
#ui-layer.touch .chat.big .chat-log, #ui-layer.touch .chat.typing .chat-log { max-height: min(150px, 38vh); }
.chat-log { touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.chat:not(.big):not(.typing) .chat-log { cursor: pointer; }
/* แท็บกรองแชท: โชว์เฉพาะตอนขยาย/พิมพ์ · ตอนย่อเห็นทุกช่องเสมอ */
.chat-tabs { display: none; gap: 3px; padding: 0 26px 2px 4px; pointer-events: auto; overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
.chat.big .chat-tabs, .chat.typing .chat-tabs { display: flex; }
.chat-tab {
  flex: none; padding: 3px 8px; font-size: 11px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  border: 1px solid #3b5378; background: rgba(10, 14, 26, 0.85); color: #c9d3ea;
}
#ui-layer.touch .chat-tab { padding: 3px 6px; font-size: 10px; }
.chat-tab.on { background: #3b5378; color: #fff; border-color: #9ad0ff; }
.chat-tab.party.on { border-color: #5ad8f0; } .chat-tab.guild.on { border-color: #7ae07a; } .chat-tab.whisper.on { border-color: #ff8ad8; } .chat-tab.system.on { border-color: #c8ffd0; }
.chat.big .chat-log[data-f="map"] .chat-line:not(.map):not(.world),
.chat.big .chat-log[data-f="party"] .chat-line:not(.party),
.chat.big .chat-log[data-f="guild"] .chat-line:not(.guild),
.chat.big .chat-log[data-f="whisper"] .chat-line:not(.whisper),
.chat.big .chat-log[data-f="system"] .chat-line:not(.system),
.chat.typing .chat-log[data-f="map"] .chat-line:not(.map):not(.world),
.chat.typing .chat-log[data-f="party"] .chat-line:not(.party),
.chat.typing .chat-log[data-f="guild"] .chat-line:not(.guild),
.chat.typing .chat-log[data-f="whisper"] .chat-line:not(.whisper),
.chat.typing .chat-log[data-f="system"] .chat-line:not(.system) { display: none; }

/* ---------- ปุ่มออโต้กลางล่าง (เหนือแถบเลือด) ---------- */
.autobar { position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; pointer-events: auto; z-index: 3; }
.auto-btn {
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 17px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; color: #e8f2ff;
  background: linear-gradient(180deg, rgba(40, 52, 88, 0.92), rgba(18, 24, 44, 0.92)); border: 1px solid rgba(154, 184, 255, 0.35); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.auto-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.auto-btn kbd { font: inherit; font-size: 10px; padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.12); color: #c9d3ea; }
.auto-btn.gear { width: 34px; padding: 0; justify-content: center; }
.auto-btn:hover { border-color: rgba(154, 184, 255, 0.7); }
.auto-btn.on { background: linear-gradient(180deg, #7ae0a0, #3aa870); color: #0a2a18; border-color: #aef0c8; animation: autoPulse 1.6s ease-in-out infinite; }
.auto-status {
  display: flex; align-items: center; gap: 6px; height: 34px; max-width: 280px; padding: 0 12px; border-radius: 17px; cursor: pointer; font: inherit; font-size: 12px; color: #0a2a18;
  background: rgba(174, 240, 200, 0.95); border: 1px solid #7ae0a0;
}
.auto-status.quest { background: rgba(255, 224, 122, 0.95); border-color: #ffd84a; color: #3a2800; }
.auto-status .auto-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auto-status b { opacity: .6; }
.auto-status:hover b { opacity: 1; }
/* ตัวติดตามเควส: เควสที่ออโต้กำลังวิ่งไปทำ */
.track.running { border-color: #ffd84a !important; box-shadow: 0 0 0 1px rgba(255, 216, 74, 0.6), 0 0 12px rgba(255, 216, 74, 0.35); }
.track-run { display: inline-block; animation: trackRun .5s steps(2) infinite; }
@keyframes trackRun { 50% { transform: translateX(2px); } }
/* มือถือ: ปุ่มออโต้กลางล่างสุด · แชทอยู่เหนือปุ่มออโต้ */
#ui-layer.touch .autobar { bottom: 10px; }
#ui-layer.touch .chat { left: 50%; transform: translateX(-50%); bottom: 52px; width: 40%; }
#ui-layer.touch .auto-btn { height: 38px; }

/* ---------- ช่องไอเทม 4 ช่อง (ยา/วาร์ป) แยกจากปุ่มลัดสกิล ---------- */
.itembar { position: absolute; right: 8px; bottom: 62px; display: flex; gap: 4px; pointer-events: auto; padding: 3px; border-radius: 12px; background: rgba(15, 22, 38, 0.45); }
.itembar .qslot { border-color: rgba(255, 200, 120, 0.4); }
.itembar .qslot .qkey { font-size: 8.5px; }
#ui-layer.touch .itembar { right: 556px; bottom: 16px; gap: 6px; background: none; padding: 0; }
#ui-layer.touch .itembar .qslot { width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, rgba(90, 70, 50, 0.6), rgba(24, 18, 14, 0.72)); border: 1.5px solid rgba(255, 210, 140, 0.45); }
#ui-layer.touch .itembar .qslot .qkey { display: none; }
/* ร้านแพ็ก */
.win-cash { width: min(440px, calc(100% - 8px)); }
.cash-pack { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: linear-gradient(180deg, rgba(255, 214, 232, 0.12), rgba(255, 255, 255, 0.04)); border: 1px solid rgba(255, 190, 220, 0.35); margin-bottom: 8px; }
.cash-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cash-price { font-family: var(--display); font-size: 18px; color: #ffd86a; }
.cash-items { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cash-item { display: flex; align-items: center; gap: 6px; font-size: 12px; }

/* ---------- สร้างตัวละคร: เลือกเพศ ---------- */
.create-look { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; margin-bottom: 6px; }
.preview-box { border-radius: 14px; background: radial-gradient(circle at 50% 80%, rgba(154, 184, 255, 0.28), rgba(10, 14, 26, 0.35)); border: 1px solid rgba(154, 184, 255, 0.25); }
.char-preview { display: block; width: 150px; height: 150px; image-rendering: pixelated; }
.look-pick { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.look-row { display: flex; align-items: center; gap: 8px; }
.look-label { font-size: 12px; color: #c9d3ea; font-weight: 600; }
.look-pick .chip {
  font: inherit; font-size: 12px; padding: 4px 9px; border-radius: 999px; cursor: pointer; color: #e8f2ff;
  background: rgba(20, 28, 52, 0.85); border: 1px solid rgba(154, 184, 255, 0.3);
}
.look-pick .chip.big { flex: 1; font-size: 15px; padding: 8px 14px; }
.look-pick .chip.on { background: linear-gradient(180deg, #ffe07a, #f5b83c); color: #3a2800; border-color: #ffe07a; font-weight: 700; }
@media (max-width: 520px) {
  .create-look { grid-template-columns: 1fr; justify-items: center; }
  .look-pick { width: 100%; }
  .look-pick .hint { text-align: center; }
}

/* มือถือแนวนอน (จอเตี้ย): การ์ดกว้างขึ้น รายชื่อตัวละคร 2 คอลัมน์ · หน้าสร้างตัวละครวางภาพซ้าย ฟอร์มขวา */
@media (max-height: 520px) and (orientation: landscape) {
  #auth { padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left)); }
  .auth-card { width: min(720px, 100%); padding: 12px 18px 14px; border-radius: 14px; }
  .brand { margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 10px; }
  .brand-logo { width: 44px; height: 44px; margin: -8px 0; }
  .brand-title { font-size: 24px; text-shadow: 0 2px 0 #5a3a00; }
  .brand-sub { font-size: 11px; margin: 0; }
  .auth-card h2 { font-size: 16px; margin: 0 0 8px; }
  .account-bar { margin-bottom: 4px; }
  .slots { grid-template-columns: 1fr 1fr; gap: 8px; }
  .slot { padding: 8px; min-height: 0; }
  .slot.filled { grid-template-columns: 56px 1fr; gap: 8px; }
  .slot-avatar, .slot-figure { width: 56px; height: 56px; }
  .slot-actions { grid-column: 1 / -1; }
  .slot-actions .btn.primary { flex: 1; }
  .slot.empty { min-height: 44px; }
  .auth-form { gap: 8px; }
  .create-form { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; align-content: start; }
  .create-form > * { grid-column: 2; }
  .create-form > .create-look { grid-column: 1; grid-row: 1 / span 6; grid-template-columns: 120px 1fr; justify-items: stretch; margin: 0; }
  .create-look .char-preview { width: 120px; height: 120px; }
  .create-look .look-pick { width: auto; }
  .create-look .look-pick .hint { text-align: left; }
  .field input { padding: 8px 10px; }
}

/* หน้าอุปกรณ์: รูปตัวละครจริงจากในเกม */
.doll-figure { display: grid; place-items: end center; overflow: hidden; }
.doll-figure.live { background-image: radial-gradient(ellipse at 50% 88%, rgba(154, 184, 255, 0.28), transparent 60%); background-size: auto; }
.doll-img { width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; transform: scale(2.05); transform-origin: 50% 97%; image-rendering: auto; }   /* ตัว HD สูง ~86/120 ของภาพสี่เหลี่ยม · กรอบสูงกว่ากว้าง ~2 เท่า → ขยายให้ตัวเต็มกรอบ */
.doll-img[hidden] { display: none; }

/* ---------- แถบเมนู: ไอคอน + ชื่อ (ปุ่ม) · ปุ่มร้านแพ็กเด่นข้างกระเป๋า ---------- */
.menubar { gap: 4px; }
.mbtn { width: auto; min-width: 46px; padding: 0 6px; }
.mbtn .mlabel { white-space: nowrap; font-size: 9.5px; letter-spacing: 0; }
.mbtn.t-shop {
  --c: #ffd86a;
  color: #4a2a00; background: linear-gradient(180deg, #ffe89a, #ffb6d0); border-color: #fff0c0;
  box-shadow: 0 0 0 2px rgba(255, 200, 120, 0.35), 0 4px 14px rgba(255, 170, 90, 0.45); animation: cash-glow 1.8s ease-in-out infinite;
}
.mbtn.t-shop .mlabel { color: #6a2a3a; font-weight: 700; }
.mbtn.t-shop::after { background: #ff6a9a; opacity: 1; }
.mbtn.t-shop:hover { color: #4a2a00; filter: brightness(1.08); }
@keyframes cash-glow { 50% { box-shadow: 0 0 0 3px rgba(255, 220, 140, 0.6), 0 4px 20px rgba(255, 150, 190, 0.7); } }
#ui-layer.touch .mbtn { width: auto; min-width: 0; padding: 0 4px; flex: 0 1 40px; overflow: hidden; }   /* หดได้เมื่อจอแคบ (ดู .menubar มือถือ) */
#ui-layer.touch .mbtn.t-shop { flex-basis: 54px; }
/* ร้านค้า: ช่องจำนวน + ราคารวม */
.qty-buy { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.qty-row { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.qty-input { width: 56px; padding: 3px 4px; text-align: center; }
.qty-total { font-size: 11px; color: #9ee0b0; }
.qty-total.bad { color: #ff8a80; }
/* แผนที่: NPC กดเดินไปคุย */
.map-chip.npc { cursor: pointer; }
.map-chip.npc:hover { background: rgba(255, 255, 255, 0.18); }
.map-chip.npc.mark { color: #3a2400; background: #ffd84a; font-weight: 700; }
/* ป้ายความเร็วสัตว์เลี้ยง: เร็วมาก → ช้ามาก */
.tip-pet { font-size: 12px; font-weight: 700; margin: 2px 0; }
.tip-pet.sp-0 { color: #ffd84a; } .tip-pet.sp-1 { color: #9ee07a; } .tip-pet.sp-2 { color: #cfe4ff; } .tip-pet.sp-3 { color: #c0b0a0; } .tip-pet.sp-4 { color: #a09080; }
/* ตีบวกแบบ Ragnarok: เกินระดับปลอดภัย = เตือนแดง */
.enh-rate b.risk { color: #ff8a70; }
.hint.enh-warn { color: #ff9a80; font-weight: 700; }
.btn.danger { background: linear-gradient(180deg, #ff8a70, #d8483a); border-color: #ffb0a0; color: #fff; font-weight: 700; box-shadow: 0 3px 0 #8a2a20; }
.btn.danger:hover:not(:disabled) { background: linear-gradient(180deg, #ff9a80, #e85848); }
/* VIP ในร้านแพ็ก */
.cash-pack.vip { border-color: #ffd24a; background: linear-gradient(180deg, rgba(255, 210, 74, 0.12), rgba(255, 210, 74, 0.03)); }
.cash-pack.vip.on .cash-price { color: #ffd24a; }
.vip-perks { margin: 4px 0 6px 18px; padding: 0; font-size: 12.5px; line-height: 1.6; }
.vip-perks b { color: #ffd24a; font-weight: 800; }
/* บัฟที่ติดอยู่: ไอคอนเรียงข้างมินิแมพ + วงนับถอยหลัง */
.buffbar { position: absolute; display: flex; flex-wrap: wrap; gap: 4px; max-width: 250px; pointer-events: auto; z-index: 3; }
.buff { position: relative; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: rgba(15, 22, 38, 0.72); }
.buff::before { content: ''; position: absolute; inset: 0; border-radius: 8px; padding: 2px;
  background: conic-gradient(#8fe07a var(--p), rgba(255, 255, 255, 0.12) 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.buff .buff-t { position: absolute; bottom: -3px; right: -3px; font-size: 9.5px; font-weight: 800; color: #fff; background: rgba(10, 16, 28, 0.9); border-radius: 6px; padding: 0 3px; line-height: 13px; }
.buff.ending { animation: buff-end 0.5s steps(2) infinite; }
@keyframes buff-end { 50% { opacity: 0.35; } }
/* ===== มือถือ: จัดใหม่ไม่ให้ทับกัน =====
   ซ้าย = จอยล้วน · ขวา = ปุ่มแอ็กชัน + สกิล 1–5 (โค้งรอบปุ่มฟัน) + สกิล 6–10 (แถวเหนือโค้ง) + บัฟ (แถวล่างข้างปุ่มกระโดด)
   ยา 4 ช่อง = ข้างมินิแมพ (ui.renderBuffs ตั้ง left/top ให้) · กลางล่าง = แชท · ปุ่มออโต้อยู่ขวาล่างข้างปุ่มเก็บ · ตัวติดตามเควสจำกัดความสูงไม่ลงไปทับจอย */
#ui-layer.touch .itembar { right: auto; bottom: auto; left: 192px; top: 94px; }
#ui-layer.touch .buffbar { left: 192px; top: 140px; right: auto; bottom: auto; }   /* บัฟ: แถวใต้ช่องยา (ข้างมินิแมพ) · ล่างกลางเป็นที่ของแชทกับปุ่มนั่ง */
#ui-layer.touch .quickbar .qslot:nth-child(n+6) { width: 40px; height: 40px; bottom: 212px; }
#ui-layer.touch .quickbar .qslot:nth-child(6) { right: 194px; }
#ui-layer.touch .quickbar .qslot:nth-child(7) { right: 148px; }
#ui-layer.touch .quickbar .qslot:nth-child(8) { right: 102px; }
#ui-layer.touch .quickbar .qslot:nth-child(9) { right: 56px; }
#ui-layer.touch .quickbar .qslot:nth-child(10) { right: 10px; }
#ui-layer.touch .autobar { top: auto; left: auto; right: 296px; bottom: 106px; transform: none; flex-direction: row-reverse; }
#ui-layer.touch .autobar .auto-status { position: absolute; right: 0; bottom: calc(100% + 6px); }   /* ป้ายสถานะลอยเหนือปุ่ม ไม่ทับแชท */
#ui-layer.touch .tracker { max-height: calc(var(--game-px, 1) * 126px); overflow-y: auto; overscroll-behavior: contain; transition: opacity 0.2s; }   /* ขอบล่าง y≈314 = เหนือหัวตัวเราตอนยืนพื้นล่างสุด (HUD_PAD_TOUCH ใน game.ts) */
#ui-layer.touch .tracker.behind { opacity: 0.4; }   /* ตัวเรายืนอยู่ใต้กล่องเควส (ui.ts) */
#ui-layer.touch .buffbar { max-width: 200px; }
#ui-layer.touch .buff { width: 28px; height: 28px; }
/* ปุ่มนั่ง: ล่างสุดข้างปุ่มกระโดด · ปุ่มออโต้ลอยเหนือกรอบแชท */
.act.sit { --c: #ffc98a; width: 46px; height: 46px; right: 290px; bottom: 12px; }
.act.sit .act-ico { width: 22px; height: 22px; }
/* แชทมือถือ: กรอบกลางล่างเห็นตลอด (ระหว่างจอยกับปุ่มนั่ง) · ข้อความล่าสุด 3 บรรทัด + ช่อง "แตะเพื่อพิมพ์" · แตะข้อความ/▲ = ขยายดูย้อนหลัง */
#ui-layer.touch .chat { left: 186px; right: 346px; bottom: 8px; width: auto; transform: none; gap: 3px; padding: 4px; border-radius: 10px;
  background: rgba(10, 14, 26, 0.5); border: 1px solid rgba(255, 255, 255, 0.14); pointer-events: auto; }
#ui-layer.touch .chat-log { max-height: 50px; padding: 1px 24px 1px 4px; font-size: 11px; background: none; border-radius: 6px; }
#ui-layer.touch .chat:not(.typing):not(.big) .chat-line.stale { display: block; }   /* กรอบอยู่ตลอด = ไม่ต้องซ่อนข้อความเก่า */
#ui-layer.touch .chat-toggle { top: 4px; right: 4px; bottom: auto; }
#ui-layer.touch .chat:has(.chat-log:empty):not(.typing) .chat-toggle { display: none; }
#ui-layer.touch .chat-row { padding: 0; }
.chat-field { display: block; padding: 6px 10px; border-radius: 8px; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.6); font-size: 12px; line-height: 1.3; cursor: text; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-field:active { border-color: var(--gold); }
.chat.typing .chat-field { display: none; }
/* แผนที่เกาะ: แผนที่ซ้าย · แผงรายละเอียด (ปุ่มเดินไปอยู่บนสุด) ขวา — ไม่ต้องเลื่อนลงหาปุ่ม */
.island-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, 34%); gap: 8px; align-items: start; }
.island-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.island-layout .map-detail { max-height: 268px; align-content: start; }
.map-go .btn { width: 100%; }
@media (max-width: 620px) { .island-layout { grid-template-columns: 1fr; } .island-layout .map-detail { max-height: none; } }
/* ตั้งค่าบอท: หัวรายการสกิล (นับที่ติ๊ก + ปุ่มเลือกทั้งหมด) · แถวสกิลกดได้ทั้งแถว */
.bot-skill-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.bot-mode { margin: 2px 0 4px; }
label.bot-skill { cursor: pointer; border-radius: 8px; }
label.bot-skill:hover { background: rgba(255, 255, 255, 0.05); }
/* แจ้งเตือนกลางจอ (ตัวละครหมดสติ ฯลฯ) */
.game-alert {
  position: absolute; left: 50%; top: 60%; transform: translate(-50%, -50%); z-index: 40; pointer-events: auto;
  width: min(360px, 80%); padding: 14px 18px 12px; border-radius: 16px; text-align: center;
  background: linear-gradient(180deg, rgba(60, 20, 30, 0.95), rgba(24, 12, 20, 0.95)); border: 2px solid rgba(255, 120, 110, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); animation: rise 0.18s ease-out; display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.game-alert-title { font-size: 18px; font-weight: 800; color: #ff9a8a; }
.game-alert p { margin: 0; font-size: 13px; line-height: 1.45; color: #f3e6ea; }
.game-alert .btn { margin-top: 4px; min-width: 110px; }
/* กล่อง "อัปเดตใหม่" ตอนเข้าเกม (client/whatsnew.ts) */
.whatsnew {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8000;
  width: min(420px, calc(100% - 32px)); max-height: calc(100% - 32px); display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px 14px; border-radius: 16px; background: var(--panel); border: 2px solid var(--gold);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); animation: rise 0.2s ease-out;
}
.whatsnew-title { font-size: 18px; font-weight: 800; color: var(--gold); text-align: center; }
.whatsnew-body { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.whatsnew-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.whatsnew-head span { font-size: 12px; opacity: 0.65; flex-shrink: 0; }
.whatsnew ul { margin: 4px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.5; }
.whatsnew-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.whatsnew-foot a { margin-right: auto; font-size: 13px; color: var(--gold); }
.whatsnew-foot .btn { min-width: 110px; }
/* ศิลาพรในแถบบัฟ: วงกลมสีศิลาพร + อักษรศิลาพร */
.buff.rune::before { background: conic-gradient(var(--rc, #7ae0ff) var(--p), rgba(255, 255, 255, 0.12) 0); }
.buff-rune { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 900; color: #10202e;
  background: radial-gradient(circle at 40% 35%, #fff, var(--rc, #7ae0ff) 70%); box-shadow: 0 0 8px var(--rc, #7ae0ff); }
.buff { cursor: pointer; }
/* สถานะผิดปกติในแถบบัฟ (พิษ/มึน/เงียบ/คำสาป/หนาวเหน็บ): วงสีสถานะ + สัญลักษณ์ กะพริบเบาๆ */
.buff.ail::before { background: conic-gradient(var(--rc) var(--p), rgba(255, 255, 255, 0.12) 0); }
.buff-ail { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 900; color: #fff;
  background: radial-gradient(circle at 40% 35%, #3a2a4a, #120a1a 75%); box-shadow: 0 0 8px var(--rc); text-shadow: 0 0 4px var(--rc); animation: ail-pulse 0.9s ease-in-out infinite alternate; }
@keyframes ail-pulse { from { opacity: 0.75; } to { opacity: 1; } }
/* เอฟเฟกต์พิเศษของการ์ด (แบบ RO) */
.card-fx { color: #ffd070; font-size: 12px; }
.mcard-fx { font-size: 10px; color: #ffe8a0; text-align: center; line-height: 1.25; padding: 0 4px; }
/* ร้าน Shell: ยอด Shell · แพ็กเรียงซ้าย→ขวา · ของเดี่ยวแถวเล็ก */
.cash-balance { display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; border-radius: 12px; background: linear-gradient(90deg, rgba(120, 200, 255, 0.18), rgba(120, 200, 255, 0.04)); }
.cash-balance b { font-size: 20px; color: #8fdcff; }
.cash-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; align-items: stretch; }
.cash-row.small { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.cash-row .cash-pack { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.cash-row .cash-pack > .btn:last-child { margin-top: auto; }
.cash-pack.big { border-color: rgba(255, 210, 74, 0.55); }
.cash-row.topups { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.map-go { display: flex; flex-direction: column; gap: 4px; }
.btn.warp-now:not(:disabled) { background: linear-gradient(180deg, #9ad8ff, #4a90e8); border-color: #cfeaff; color: #0a1a30; font-weight: 700; }
/* แผนที่เกาะ: ทุ่งหญ้า + ถนนดิน + หญ้าป่า/ดอกไม้ */
.island-board {
  background:
    radial-gradient(ellipse 22% 16% at 18% 24%, rgba(120, 190, 70, 0.55), transparent 70%),
    radial-gradient(ellipse 26% 18% at 78% 70%, rgba(90, 160, 60, 0.5), transparent 70%),
    radial-gradient(ellipse 18% 14% at 60% 18%, rgba(150, 205, 90, 0.45), transparent 70%),
    radial-gradient(ellipse 20% 16% at 30% 82%, rgba(100, 170, 60, 0.45), transparent 70%),
    linear-gradient(180deg, #9fd26a, #7fbf55 60%, #6fae4a);
  border-color: rgba(60, 100, 40, 0.6);
  box-shadow: inset 0 0 30px rgba(30, 60, 20, 0.35), 0 4px 12px rgba(0, 0, 0, 0.25);
}
.routes.solid line { stroke-dasharray: none; filter: none; stroke-linecap: round; }
.routes.solid line.road-edge { stroke: #6b4a26; stroke-width: 15px; }
.routes.solid line.road { stroke: #c89a5c; stroke-width: 10px; }
.routes.solid line.road-mid { stroke: #e8cc94; stroke-width: 1.6px; stroke-dasharray: 5 7; }
.routes.solid line.road-edge.gated { stroke: #7a7468; }
.routes.solid line.road.gated { stroke: #b8b2a2; }
.routes.solid line.road-mid.gated { stroke: #ffd28a; stroke-dasharray: 3 5; }
.isle-deco { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.routes { z-index: 1; }
.map-node { z-index: 2; }
.isle-deco .tuft { position: absolute; width: 14px; height: 10px; transform: translate(-50%, -100%) scale(var(--s, 1));
  background:
    linear-gradient(70deg, transparent 45%, #3f8a2e 46% 58%, transparent 59%) 0 0 / 7px 10px no-repeat,
    linear-gradient(90deg, transparent 42%, #4f9c36 43% 58%, transparent 59%) 4px 0 / 6px 10px no-repeat,
    linear-gradient(110deg, transparent 42%, #3f8a2e 43% 55%, transparent 56%) 8px 1px / 6px 9px no-repeat; }
.isle-deco .tuft.tall { height: 15px; filter: brightness(0.9); }
.isle-deco .flower { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #fff4f8; box-shadow: 0 0 0 1.5px #f28ab0; transform: translate(-50%, -50%) scale(var(--s, 1)); }
.isle-deco .flower.y { background: #fff0a0; box-shadow: 0 0 0 1.5px #e8b040; }
.map-route-legend .route-sample.walk { background: #c89a5c; box-shadow: 0 0 0 2px #6b4a26; }
.map-route-legend .route-sample.gated { background: #b8b2a2; box-shadow: 0 0 0 2px #7a7468; }
/* ของ Rare: กรอบทองเรือง */
.slot-cell.rare { border-color: #ffb020 !important; box-shadow: 0 0 0 1px #ffb020, 0 0 10px rgba(255, 176, 32, 0.55); }
/* ดวล PvP: แถบกลางบน */
.duel-bar { position: absolute; left: 50%; top: 58px; transform: translateX(-50%); z-index: 20; pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; border-radius: 99px; background: linear-gradient(90deg, rgba(120, 20, 30, 0.9), rgba(60, 10, 20, 0.9)); border: 1.5px solid #ff7a6a; color: #fff; font-size: 13px; }
.duel-bar[hidden] { display: none; }
.duel-count { color: #ffd84a; font-weight: 800; font-size: 16px; }
#ui-layer.touch .duel-bar { top: 100px; }
/* ร้าน Shell: กว้างพอให้แพ็ก 3 อันเรียงซ้าย→ขวา · รายการของในแพ็กเป็นไอคอนเล็กเรียงแถว */
.win-cash { width: min(780px, calc(100% - 8px)); }
.cash-row .cash-items { grid-template-columns: 1fr; gap: 4px; }
.cash-row .cash-item { font-size: 11.5px; line-height: 1.25; }
.cash-row .cash-item .slot-cell { width: 30px; height: 30px; flex: 0 0 30px; }
.cash-row .cash-head { display: flex; flex-direction: column; gap: 2px; }
.cash-row .cash-head .cash-price { font-size: 16px; }
.cash-row .item-desc { font-size: 11.5px; }
/* ตั้งค่าภาพ + ตัวนับ FPS */
.gfx-seg { margin: 0; }
.gfx-seg .tab { padding: 4px 10px; font-size: 12px; }
.fps-meter { position: absolute; right: 8px; top: 52px; z-index: 30; pointer-events: none; padding: 2px 8px; border-radius: 8px; font: 700 12px/1.4 monospace; color: #9effa8; background: rgba(0, 0, 0, 0.55); }
.fps-meter.low { color: #ff8a7a; }
.fps-meter[hidden] { display: none; }
.sound-box .vol-row:has(.gfx-seg) { flex-wrap: wrap; row-gap: 4px; }
.gfx-seg { flex-wrap: wrap; }

/* ======================================================================
   หน้าต่างพอดีจอ + แถบ HUD ล่างแบ่งโซน (ชั้น UI กว้าง 960 · สูง 540)
   ====================================================================== */
/* เนื้อหาหน้าต่างไม่ต้องเลื่อน: ui.ts fitBody() ย่อด้วย --fit เมื่อยาวเกิน · รายการยาวใช้แบ่งหน้า (.pager) */
.win-body > *, .panel-body > * { zoom: var(--fit, 1); }
/* ห้ามลูกหดตามความสูงหน้าต่าง (การ์ดที่ overflow:hidden เช่น .mail-row จะโดนตัดปุ่มทิ้ง และ fitBody วัดความสูงผิดจนปิดการเลื่อน) */
.win-body > * { flex-shrink: 0; }
.win-body.fitted, .panel-body.fitted { overflow-x: hidden; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.two-col > .col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.two-col > .col > .sound-box, .two-col > .col > .cash-pack { margin-bottom: 0; }
/* เมนู: ติดตามข่าวสาร (Facebook / Discord) */
.follow-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.follow-link {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; padding: 8px 10px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.05); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.follow-link b { font-size: 14px; }
.follow-link span { font-size: 11px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.follow-link.fb { border-color: rgba(24, 119, 242, 0.55); background: rgba(24, 119, 242, 0.16); }
.follow-link.fb:hover { background: rgba(24, 119, 242, 0.28); }
.follow-link.dc { border-color: rgba(88, 101, 242, 0.55); background: rgba(88, 101, 242, 0.16); }
.follow-link.dc:hover { background: rgba(88, 101, 242, 0.28); }
.follow-link.soon { opacity: 0.55; cursor: default; }
.follow-link.soon:hover { background: rgba(88, 101, 242, 0.16); }
.list-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.list-2 > * { margin: 0 !important; min-width: 0; }
.list-2.tight { gap: 2px 16px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; }
.pager-n { min-width: 48px; text-align: center; font-weight: 700; color: var(--ink-dim); }
.chip.dot::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: #ff5a6a; vertical-align: middle; }

/* ความกว้างหน้าต่างที่แบ่ง 2 คอลัมน์ */
.win-stats { width: 600px; }
.win-skills { width: 660px; }
.sk-cols { grid-template-columns: 1.15fr 1fr; }
.win-menu { width: 620px; }
.win-bot { width: 700px; }
.win-collection { width: 640px; }
.win-cash { width: min(900px, calc(100% - 8px)); }
.cash-cols { grid-template-columns: 1.75fr 1fr; }
.cash-cols .cash-row { grid-template-columns: repeat(3, 1fr); }
.cash-cols .cash-row.small { grid-template-columns: repeat(4, 1fr); }
.cash-cols .cash-row.topups { grid-template-columns: 1fr 1fr; }
.cash-cols .vip-perks { margin: 0; padding-left: 18px; font-size: 12px; }
#ui-layer:not(.touch) .panel { bottom: 78px; }

/* ---------- แถบ HUD ล่าง (คอม): ภาพพื้น/เลือด/EXP วาดใน game.ts drawBar · ส่วน HTML วางตามโซน ----------
   โซน: Lv/ชื่อ 8–104 · HP/MP/Vis 112–252 · ปุ่มลัด 1–0 567–954 · แชท 262–558 · (ช่องไอเทม + ปุ่มออโต้ลอยเหนือแถบทางขวา) · EXP 12 px ล่างสุด */
#ui-layer:not(.touch) .quickbar { right: 6px; bottom: 24px; gap: 3px; }
#ui-layer:not(.touch) .itembar { right: 6px; bottom: 78px; gap: 3px; padding: 0; background: none; border-radius: 0; }   /* ช่องยา: ตรงคอลัมน์กับปุ่มลัด 7–0 พอดี ลอยเหนือแถบ HUD */
/* แชท: อยู่ในแถบ HUD เต็มโซนว่าง 262–558 (ตอนพิมพ์/ขยาย ประวัติแชทยืดขึ้นไปเหนือแถบ) */
#ui-layer:not(.touch) .chat { left: 262px; bottom: 15px; width: 296px; }
#ui-layer:not(.touch) .chat:not(.typing):not(.big) .chat-log { max-height: 52px; }
#ui-layer:not(.touch) .chat-log { border-radius: 8px; }
/* ปุ่มออโต้: ลอยเหนือแถบ HUD ชิดขวา ถัดจากช่องยาไปทางซ้าย (ช่องยา 801–954) */
#ui-layer:not(.touch) .autobar { left: auto; right: 166px; bottom: 79px; transform: none; }
#ui-layer:not(.touch) .autobar .auto-status { position: absolute; right: 0; bottom: calc(100% + 6px); }   /* ป้ายสถานะลอยเหนือปุ่ม ไม่ยืดไปทับแชท */
.two-col.three { grid-template-columns: 1fr 1fr 1.15fr; }
.win-bot { width: min(900px, calc(100% - 8px)); }
/* ปุ่มย่อ/ขยายแชทอยู่มุมบนขวาของกล่องแชทเสมอ ไม่ลงไปทับแถบ HUD ตอนแชทว่าง */
#ui-layer:not(.touch) .chat-toggle { top: auto; bottom: calc(100% + 2px); }
.cash-top { display: flex; flex-direction: column; gap: 8px; }
.win-cash .cash-row.small { grid-template-columns: repeat(auto-fill, minmax(200px, 240px)); }

/* มือถือถือแนวตั้ง: บังทั้งหน้า (รวมหน้าเข้าสู่ระบบ) จนกว่าจะหมุนเป็นแนวนอน */
#rotate, #fullscreen {
  position: fixed; inset: 0; z-index: 10000; display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px 16px; text-align: center; background: var(--bg); color: var(--ink); touch-action: none; cursor: pointer;
}
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }
body.need-fullscreen #fullscreen { display: flex; }   /* main.ts ใส่คลาสนี้ตอนมือถือยังไม่เต็มจอ */
#fullscreen { z-index: 9999; }                        /* แนวตั้ง: ให้หน้าหมุนจออยู่บนสุด */

/* iPhone: บอกวิธีเพิ่มไปยังหน้าจอโฮม (main.ts ใส่ need-install + data-mode) */
#ios-install {
  position: fixed; inset: 0; z-index: 9998; display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 16px; background: var(--bg); color: var(--ink); overflow-y: auto; touch-action: pan-y;
}
body.need-install #ios-install { display: flex; }
.ios-steps { display: none; margin: 0; padding-left: 22px; max-width: 420px; text-align: left; font-size: 15px; line-height: 1.7; }
#ios-install[data-mode="safari"] .ios-steps[data-for="safari"],
#ios-install[data-mode="inapp"] .ios-steps[data-for="inapp"] { display: block; }
.ios-share { width: 20px; height: 20px; vertical-align: -4px; color: #4da3ff; }
.rotate-phone {
  width: 56px; height: 96px; margin-bottom: 18px; border: 4px solid var(--gold); border-radius: 12px; position: relative;
  animation: rotate-hint 2.2s ease-in-out infinite;
}
.rotate-phone::after { content: ''; position: absolute; left: 50%; bottom: 6px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--gold); }
.rotate-title { margin: 0; font-family: var(--display); font-size: 22px; }
.rotate-sub { margin: 0; max-width: 280px; font-size: 14px; color: var(--ink-dim); }
@keyframes rotate-hint { 0%, 25% { transform: rotate(0deg); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0deg); } }
@media (prefers-reduced-motion: reduce) { .rotate-phone { animation: none; transform: rotate(-90deg); } }

/* ---------- แท็บอาชีพถัดไป ---------- */
.sk-tabs .sk-next-tab { margin-left: auto; color: #d8c8ff; }
.sk-tabs .sk-next-tab.ready { color: #ffe07a; animation: nj-pulse 1.4s ease-in-out infinite; }
@keyframes nj-pulse { 50% { box-shadow: 0 0 0 3px rgba(255, 224, 122, 0.35); } }
.nj-progress { padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(160, 140, 255, 0.35); display: flex; flex-direction: column; gap: 5px; }
.nj-progress.ready { border-color: #ffe07a; background: rgba(255, 224, 122, 0.08); }
.nj-progress-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.nj-bar { height: 7px; border-radius: 99px; background: rgba(0, 0, 0, 0.35); overflow: hidden; }
.nj-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8a6aff, #ffe07a); border-radius: inherit; }
.nj-jobs { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.nj-job { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px; border-radius: 12px; cursor: pointer; font: inherit; color: var(--ink);
  background: color-mix(in srgb, var(--job) 14%, rgba(255, 255, 255, 0.03)); border: 1.5px solid color-mix(in srgb, var(--job) 45%, transparent); }
.nj-job b { color: var(--job); font-size: 13px; }
.nj-job .dim { font-size: 11px; }
.nj-job .pill { font-size: 10px; }
.nj-job.sel { border-color: #ffe07a; background: color-mix(in srgb, var(--job) 30%, rgba(255, 255, 255, 0.05)); box-shadow: 0 0 0 3px rgba(255, 224, 122, 0.15); }
.nj-label { font-size: 12px; font-weight: 700; color: #c8b8ff; margin-top: 2px; }
.track.guide.link { cursor: pointer; font: inherit; text-align: left; width: 100%; }
.track.guide.link:hover { opacity: 1; filter: brightness(1.15); }
.nj-toast { cursor: pointer; font: inherit; border-color: #a08aff; }
.nj-toast.ready { border-color: #ffe07a; color: #fff1b8; font-weight: 700; }

/* สลับอาชีพ (ช่วงทดสอบ) — หน้าต่างสเตตัส */
.jobswap-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.jobswap-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 6px; }
.jobswap-btn { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 4px; border-radius: 8px; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--job) 70%, transparent); background: color-mix(in srgb, var(--job) 16%, transparent); color: inherit; font: inherit; font-size: 12px; }
.jobswap-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--job) 30%, transparent); }
.jobswap-btn.on { border-color: var(--job); background: color-mix(in srgb, var(--job) 40%, transparent); cursor: default; }
.jobswap-btn .dim { font-size: 11px; }
.mbtn.t-swap { --c: #7ae0ff; color: #0a3048; background: linear-gradient(180deg, #b8f0ff, #7ac8ff); border-color: #e0f8ff; box-shadow: 0 0 0 2px rgba(120, 210, 255, 0.35); }
.mbtn.t-swap .mlabel { color: #0a3048; font-weight: 700; }
.mbtn.t-swap:hover { color: #0a3048; filter: brightness(1.08); }
.item-desc.good { color: #9ee07a; }
/* สุ่มค่าใหม่ที่ช่าง: บรรทัดละแถว ติ๊กล็อก · ค่า MAX สีทอง */
.reroll-lines { display: grid; gap: 4px; margin: 6px 0; }
.reroll-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); cursor: pointer; font-size: 13px; }
.reroll-row.locked { background: rgba(255, 208, 96, 0.12); }
.reroll-row.max b { color: #ffd060; }
.reroll-name { min-width: 48px; }
/* คราฟของ Rare จากเศษบอส (ช่างตีเหล็ก) */
.craft-list { display: grid; gap: 6px; margin: 6px 0; }
.craft-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.craft-row .item-main { flex: 1; min-width: 0; }
.craft-mats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; margin-top: 2px; }
.craft-mats span { display: inline-flex; align-items: center; gap: 2px; }
.craft-mats .bad { color: #ff8a7a; }

/* ---------- เลือกเซิร์ฟ (ภูมิภาค) ---------- */
.region-label { font-size: 13px; font-weight: 700; color: var(--ink-dim); margin-bottom: 6px; }
.region-list { display: flex; flex-direction: column; gap: 6px; min-width: min(360px, 80vw); }
.region-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; cursor: pointer; font: inherit; color: var(--ink); text-align: left;
  background: rgba(255, 255, 255, 0.04); border: 1.5px solid rgba(255, 255, 255, 0.14); }
.region-row:hover { background: rgba(255, 255, 255, 0.08); }
.region-row.here { border-color: #ffe07a; background: rgba(255, 224, 122, 0.12); cursor: default; }
.region-row.closed { opacity: 0.6; }
.region-code { min-width: 42px; text-align: center; font-size: 11px; font-weight: 800; letter-spacing: 0.5px; padding: 3px 6px; border-radius: 6px; background: #2e4770; color: #dfe9ff; }
.region-row.here .region-code { background: #ffe07a; color: #3a2400; }
.region-name { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.region-name b { font-size: 15px; }
.region-here { font-size: 12px; color: #8fe0a0; font-weight: 600; }
.region-count { font-weight: 700; font-size: 13px; white-space: nowrap; }
.region-row.closed .region-count { color: var(--ink-dim); font-weight: 600; }
/* ไอเทมที่ล็อกไว้ (กันขาย/ทิ้ง/แลก) */
.slot-lock { position: absolute; right: 1px; top: 1px; font-size: 10px; line-height: 1; filter: drop-shadow(0 1px 1px #000); pointer-events: none; }
.slot-cell.gear-cell .slot-lock { top: auto; bottom: 1px; }
.sellall { display: grid; gap: 6px; margin: 4px 0 8px; }

/* ร้านทำผม */
.barber-sec { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 4px; }
.barber-row { display: flex; flex-wrap: wrap; gap: 5px; }
.hair-sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); cursor: pointer; padding: 0; box-shadow: inset 0 -3px 6px rgba(0,0,0,.25); }
.hair-sw.on { border-color: #ffe08a; box-shadow: 0 0 0 2px #ffe08a, inset 0 -3px 6px rgba(0,0,0,.25); transform: scale(1.1); }
.hair-sw.none { background: rgba(255,255,255,.08); color: #ccc; font-size: 12px; }
.barber-row .tab { white-space: nowrap; flex: 0 0 auto; padding: 3px 9px; font-size: 12px; }

/* หน้าสร้างตัวละคร: ตัวละคร HD (client/charselect.ts mountStage) ทับภาพพิกเซลสำรอง */
.create-stage { --char-h: 150px; position: relative; width: 170px; height: 190px; display: flex; align-items: center; justify-content: center; }
.create-foot { position: absolute; left: 50%; bottom: 14px; width: 2px; height: 2px; }
.create-stage.hd-on > .char-preview { visibility: hidden; }
