:root {
  --bg: #0b0705;
  --panel: rgba(24, 15, 9, 0.93);
  --panel2: rgba(40, 26, 15, 0.95);
  --line: #8a6a38;
  --gold: #e8c46a;
  --gold2: #c8a050;
  --text: #efe2c6;
  --dim: #a8987a;
  --red: #b8321e;
  --hp: linear-gradient(180deg, #e8503a, #9a1e12);
  --mp: linear-gradient(180deg, #4a8ae8, #1a3a9a);
  --exp: linear-gradient(180deg, #8ad84a, #3a7a1a);
  --font: 'Sarabun', 'Kanit', system-ui, sans-serif;
  --head: 'Kanit', 'Sarabun', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; user-select: none; }
canvas#game { position: fixed; inset: 0; display: block; }
button { font-family: inherit; }
input, select { font-family: inherit; }
[hidden] { display: none !important; }
kbd { font-family: var(--head); font-size: 10px; padding: 0 4px; border: 1px solid #6a5030; border-radius: 3px; background: #1a100a; color: var(--gold); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(255, 220, 150, 0.08), 0 8px 24px rgba(0, 0, 0, 0.6);
  border-radius: 6px;
}
.btn {
  background: linear-gradient(180deg, #4a3220, #2a1a0e);
  color: var(--text); border: 1px solid var(--line); border-radius: 4px;
  padding: 8px 18px; font-family: var(--head); font-size: 15px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 220, 160, 0.15);
}
.btn:hover { filter: brightness(1.25); }
.btn:disabled { opacity: 0.4; cursor: default; filter: none; }
.btn.gold { background: linear-gradient(180deg, #c8902a, #7a4a10); border-color: #f0c860; color: #fff6dc; text-shadow: 0 1px 2px #000; }
.btn.danger { background: linear-gradient(180deg, #8a2a1a, #4a100a); border-color: #c85a3a; }
.btn.sm { padding: 3px 10px; font-size: 12.5px; }
.tt-dim { color: var(--dim); font-size: 12.5px; }

/* ================= Screens ================= */
#screens { position: fixed; inset: 0; z-index: 10; overflow: auto; }
.screen { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 30px 16px; }
.logo { text-align: center; filter: drop-shadow(0 4px 12px #000); }
.logo-th { font-family: 'Srisakdi', serif; font-size: clamp(64px, 12vw, 120px); line-height: 1; color: #d8321e; text-shadow: 0 0 2px #000, 0 0 30px rgba(220, 40, 20, 0.6), 3px 3px 0 #2a0604; letter-spacing: 4px; }
.logo-en { font-family: var(--head); letter-spacing: 10px; color: var(--gold); font-size: 18px; margin-top: 4px; }
.logo-sub { color: var(--dim); font-size: 13px; margin-top: 4px; letter-spacing: 2px; }
.login-box, .select-box, .create-box { padding: 22px 26px; width: min(420px, 100%); }
.login-box label { display: block; margin-bottom: 12px; color: var(--dim); font-size: 13px; }
.login-box input, .create-opts input { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; background: #120a06; border: 1px solid #5a4024; color: var(--text); border-radius: 4px; font-size: 15px; outline: none; }
.login-box input:focus, .create-opts input:focus { border-color: var(--gold); }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.err { color: #ff7a5a; min-height: 20px; font-size: 13px; margin: 4px 0; text-align: center; }
.hint { color: var(--dim); font-size: 12px; text-align: center; margin-top: 12px; }
.story { width: min(560px, 100%); padding: 14px 20px; font-size: 13.5px; line-height: 1.7; color: #d8c8a8; }
.story p { margin: 6px 0; }
.story b { color: #ff6a4a; }
.select-box { width: min(1000px, 100%); }
.select-box h3, .create-box h3 { font-family: var(--head); margin: 0 0 14px; color: var(--gold); text-align: center; font-weight: 500; }
.char-slots { display: grid; grid-template-columns: repeat(3, min(250px, 27vw)); justify-content: center; gap: 28px; margin: 6px 0 18px; }
.char-slot { align-self: start; text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cs-frame { position: relative; width: 100%; flex-shrink: 0; aspect-ratio: 2 / 3; background: #120a06; border: 1px solid #4a3420; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.cs-frame canvas { position: absolute; left: 50%; top: 16%; height: 66%; width: auto; transform: translateX(-50%); }
.char-slot.on .cs-frame { border-color: var(--gold); box-shadow: 0 0 14px rgba(232, 196, 106, 0.35); }
.cs-info { min-height: 62px; }
.cs-name.dim { color: var(--dim); }
.cs-name { font-family: var(--head); font-size: 19px; color: var(--gold); text-shadow: 0 1px 3px #000; }
.cs-sub, .cs-map { font-size: 13.5px; color: #cfc0a0; text-shadow: 0 1px 2px #000; }
.cs-plus { font-size: 48px; color: var(--line); }
.create-box { width: min(760px, 100%); }
.create-row { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.create-prev { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.create-prev canvas { border: 1px solid var(--line); border-radius: 6px; max-width: 100%; }
.create-opts { flex: 1; min-width: 260px; }
.opt { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.opt > span { width: 86px; color: var(--dim); font-size: 13px; flex-shrink: 0; }
.opt input { margin: 0 !important; }
.seg { display: flex; gap: 6px; }
.seg button, .stepper button { background: #1a100a; border: 1px solid #5a4024; color: var(--text); padding: 5px 12px; border-radius: 4px; cursor: pointer; }
.seg button.on { border-color: var(--gold); color: var(--gold); background: #2a1a0c; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper span { min-width: 100px; text-align: center; font-family: var(--head); color: var(--gold); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches i { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #2a1a0c; cursor: pointer; }
.swatches i.on { border-color: var(--gold); box-shadow: 0 0 8px var(--gold); }

/* ================= HUD ================= */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
.frame { background: linear-gradient(180deg, rgba(30,19,10,.94), rgba(16,10,5,.94)); border: 2px solid #8a6a38; border-radius: 4px; box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(255,220,150,.12), 0 8px 26px rgba(0,0,0,.7); position: relative; }
.frame::before, .frame::after { content: ''; position: absolute; width: 14px; height: 14px; border: 2px solid #e8c46a; pointer-events: none; }
.frame::before { top: -4px; left: -4px; border-right: 0; border-bottom: 0; }
.frame::after { bottom: -4px; right: -4px; border-left: 0; border-top: 0; }

#playerFrame { position: absolute; left: 14px; top: 10px; display: flex; gap: 10px; align-items: flex-start; width: 340px; }
.pf-portrait { position: relative; flex-shrink: 0; }
#portrait { width: 96px; height: 96px; border-radius: 50%; border: 3px solid #c8a050; box-shadow: 0 0 0 2px #000, 0 0 16px rgba(0,0,0,.9); display: block; background: #120a06; }
.pf-lv { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); background: linear-gradient(180deg, #3a2410, #1a0e06); border: 1px solid #c8a050; border-radius: 10px; padding: 0 10px; font-family: var(--head); font-size: 13px; color: #fff; white-space: nowrap; box-shadow: 0 2px 6px #000; }
.pf-info { flex: 1; padding-top: 4px; }
.pf-name { display: flex; align-items: center; justify-content: space-between; font-family: var(--head); font-size: 20px; color: #fff; text-shadow: 0 2px 4px #000; line-height: 1.1; }
#pfPlus { width: 24px; height: 24px; border: 1px solid #c8a050; background: rgba(20,12,6,.85); color: #e8c46a; border-radius: 4px; cursor: pointer; font-size: 16px; line-height: 1; }
#pfPlus.pulse { animation: pulse 1.2s infinite; color: #fff; background: #8a5a10; }
@keyframes pulse { 50% { box-shadow: 0 0 12px #ffd060; } }
.pf-title { font-size: 12.5px; color: var(--dim); margin-bottom: 4px; text-shadow: 0 1px 2px #000; }
.bar { position: relative; height: 15px; background: rgba(8,4,2,.85); border: 1px solid #4a3418; border-radius: 2px; margin-bottom: 3px; overflow: hidden; box-shadow: 0 1px 3px #000; }
.bar i { position: absolute; inset: 0 auto 0 0; transition: width 0.2s; }
.bar span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 13px; text-shadow: 0 0 2px #000, 0 0 2px #000; font-weight: 600; }
.bar.hp i { background: var(--hp); }
.bar.mp i { background: var(--mp); }
#buffs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.buff { position: relative; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 50%; background: #000; overflow: hidden; }
.buff img { width: 100%; height: 100%; }
.buff span { position: absolute; bottom: -1px; left: 0; right: 0; text-align: center; font-size: 8.5px; font-weight: 700; text-shadow: 0 0 2px #000, 0 0 2px #000; }
.buff.debuff { border-color: #c83a2a; display: flex; align-items: center; justify-content: center; background: #3a0a0a; }
.buff.debuff b { font-size: 7.5px; }
.buff.sit { display: flex; align-items: center; justify-content: center; font-size: 14px; }

#sidePanel { position: absolute; left: 14px; top: 132px; width: 340px; background: rgba(16,10,5,.82); border-color: #6a5028; }
#sidePanel.folded #spBody { display: none; }
.sp-tabs { display: flex; gap: 2px; padding: 4px 4px 0; border-bottom: 1px solid #4a3418; }
.sp-tabs button { flex: 1; background: transparent; border: 0; color: var(--dim); font-family: var(--head); font-size: 13px; padding: 5px 4px; cursor: pointer; border-radius: 3px 3px 0 0; }
.sp-tabs button.on { background: linear-gradient(180deg, #a07028, #5a3a12); color: #fff8e0; }
.sp-tabs .sp-fold { flex: 0 0 26px; }
#spBody { padding: 4px 6px 6px; max-height: 280px; overflow-y: auto; }
.sq { display: flex; gap: 8px; padding: 7px 4px; border-bottom: 1px solid rgba(90,64,36,.5); cursor: pointer; position: relative; }
.sq.nav { background: linear-gradient(90deg, rgba(255,210,100,.16), rgba(255,210,100,.03)); box-shadow: inset 3px 0 0 #ffd26e; }
.sq-info { position: absolute; right: 2px; top: 4px; border: 0; background: none; cursor: pointer; font-size: 13px; opacity: .55; padding: 2px 4px; }
.sq-info:hover { opacity: 1; }
.sq-name { padding-right: 22px; }
.sq:hover { background: rgba(90,60,20,.25); }
.sq:last-child { border-bottom: 0; }
.sq-ic { width: 22px; height: 22px; border-radius: 50%; color: #1a0e04; font-weight: 800; font-family: var(--head); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 0 0 2px rgba(0,0,0,.6); font-size: 14px; }
.sq-main { flex: 1; min-width: 0; }
.sq-name { font-family: var(--head); font-size: 14.5px; color: #f6ead0; text-shadow: 0 1px 2px #000; }
.sq-name span { font-size: 12.5px; }
.sq-obj { font-size: 12.5px; color: #cfc0a0; display: flex; justify-content: space-between; gap: 6px; }
.sq-dist { color: var(--dim); white-space: nowrap; font-size: 12px; }
.sq.done .sq-obj { color: #7affb0; }
.sp-empty { color: var(--dim); font-size: 12.5px; padding: 10px 4px; }
.sp-sub { font-size: 12px; color: var(--gold2); margin: 4px 0 2px; }
.sp-player { position: relative; font-size: 12.5px; padding: 3px 4px 5px; }
.sp-player i { position: absolute; left: 4px; bottom: 1px; height: 2px; background: #3ac84a; max-width: 120px; }
.sp-sys { font-size: 12px; color: #ffd88a; padding: 2px 0; }
.sp-sys span { color: var(--dim); }

#targetFrame { position: absolute; top: 92px; left: 50%; transform: translateX(-50%); padding: 6px 12px; width: 280px; text-align: center; z-index: 5; }
.tf-name { font-family: var(--head); color: #ffb0a0; font-size: 14px; }
.tf-x { position: absolute; top: -10px; right: -10px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--gold2); background: rgba(40,10,6,.95); color: #ffb0a0; font-size: 15px; line-height: 1; cursor: pointer; z-index: 2; box-shadow: 0 2px 6px rgba(0,0,0,.6); }
.tf-x:hover { background: #7a1a10; color: #fff; }
body.mobile .tf-x { width: 40px; height: 40px; top: -14px; right: -14px; font-size: 19px; }
.tf-sub { font-size: 11px; color: var(--dim); }

#topMenu { position: absolute; right: 196px; top: 8px; display: flex; gap: 2px; }
.menu-btn { position: relative; width: 66px; background: transparent; border: 0; color: #f0e2c4; cursor: pointer; display: flex; flex-direction: column; align-items: center; padding: 2px 0; text-shadow: 0 1px 3px #000, 0 0 6px #000; }
.menu-btn img { width: 34px; height: 34px; filter: drop-shadow(0 2px 3px #000) sepia(.3); transition: transform .12s; }
.menu-btn:hover img { transform: scale(1.12); filter: drop-shadow(0 0 6px #ffd060); }
.menu-btn span { font-family: var(--head); font-size: 13px; }
.menu-btn kbd { margin-top: 2px; font-size: 10px; padding: 0 5px; background: rgba(10,6,3,.9); }
#clock { position: absolute; right: 16px; top: 18px; display: flex; gap: 10px; align-items: center; text-shadow: 0 1px 3px #000, 0 0 8px #000; }
.ck-icon { font-size: 26px; filter: drop-shadow(0 0 6px rgba(255,240,200,.6)); }
.ck-date { font-size: 13px; color: #f0e2c4; text-align: right; }
.ck-time { font-family: var(--head); font-size: 16px; color: #fff; }

#minimap { position: absolute; right: 14px; top: 92px; width: 292px; padding: 4px 6px 6px; }
#minimap.folded .mm-wrap, #minimap.folded .mm-foot { display: none; }
.mm-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 5px; font-family: var(--head); color: #f6ead0; font-size: 15px; }
.mm-head #mmName { flex: 1; }
.mm-ch { color: var(--dim); font-size: 13px; }
.mm-x { background: rgba(0,0,0,.4); border: 1px solid #6a5028; color: #f0e2c4; border-radius: 3px; cursor: pointer; width: 22px; height: 22px; font-size: 11px; }
.mm-wrap { position: relative; }
#mmCanvas { display: block; width: 276px; height: 214px; border: 1px solid #3a2a18; cursor: pointer; }
.mm-zoom { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 4px; }
.mm-zoom button { width: 26px; height: 26px; border: 1px solid #8a6a38; background: rgba(20,12,6,.85); color: #f0e2c4; border-radius: 3px; cursor: pointer; font-size: 14px; }
.mm-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; padding-top: 5px; color: #e8dcc0; }
#mmEvent { color: #d8a0ff; font-size: 12px; flex: 1; text-align: center; }

#chat { position: absolute; left: 14px; bottom: 14px; width: 470px; height: 250px; display: flex; flex-direction: column; background: rgba(14, 9, 5, 0.84); border-color: #6a5028; }
.chat-tabs { display: flex; gap: 2px; padding: 4px 4px 0; border-bottom: 1px solid #4a3418; }
.chat-tabs button { background: transparent; border: 0; color: var(--dim); font-family: var(--head); font-size: 13px; padding: 4px 14px; border-radius: 3px 3px 0 0; cursor: pointer; }
.chat-tabs button.on { background: linear-gradient(180deg, #a07028, #5a3a12); color: #fff8e0; }
#chatLog { flex: 1; overflow-y: auto; padding: 4px 10px; font-size: 13px; line-height: 1.55; user-select: text; }
#chatLog .time { color: #8a7a60; }
#chatLog .tag { color: #a8c8ff; }
#chatLog .cl-sys .tag, #chatLog .cl-sys { color: #ffd88a; }
#chatLog .cl-map .tag { color: #9aff9a; }
#chatLog .cl-whisper, #chatLog .cl-whisper .tag { color: #e0a0ff; }
#chatLog b { color: #fff; font-weight: 600; }
.chat-input { display: flex; gap: 4px; padding: 5px; border-top: 1px solid #4a3418; align-items: center; }
.chat-input select { background: #1a100a; color: var(--gold); border: 1px solid #4a3418; border-radius: 3px; font-size: 12px; padding: 4px; }
.chat-input input { flex: 1; background: rgba(0,0,0,.55); border: 1px solid #4a3418; border-radius: 3px; color: var(--text); padding: 6px 9px; font-size: 13px; outline: none; }
.chat-input input:focus { border-color: var(--gold2); }

#hotbarWrap { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; }
#hotbar { display: flex; gap: 4px; padding: 6px 8px 16px; background: linear-gradient(180deg, rgba(34,22,12,.95), rgba(14,9,5,.95)); border: 2px solid #8a6a38; border-radius: 6px; box-shadow: 0 0 0 1px #000, 0 6px 20px rgba(0,0,0,.7); align-items: flex-start; }
#hbSlots { display: flex; gap: 4px; }
.hb-gap { width: 8px; }
.hb-slot, .hb-weapon { position: relative; width: 52px; height: 52px; background: #0c0703; border: 1px solid #6a5028; border-radius: 4px; cursor: pointer; }
.hb-weapon { margin-right: 6px; border-color: #a08040; background: radial-gradient(circle, #2a1a0c, #0c0703); }
.hb-weapon img { width: 100%; height: 100%; border-radius: 3px; }
.hb-slot:hover, .hb-weapon:hover { border-color: var(--gold); }
.hb-slot img { width: 100%; height: 100%; display: block; border-radius: 3px; }
.hb-slot kbd { position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); font-size: 10px; padding: 0 3px; background: none; border: 0; color: #d8c8a8; }
.hb-slot .cd { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-family: var(--head); font-size: 17px; color: #fff; text-shadow: 0 0 3px #000; border-radius: 3px; }
.hb-slot .cnt { position: absolute; bottom: 1px; right: 3px; font-size: 11px; text-shadow: 0 0 2px #000, 0 0 2px #000; }
.hb-slot.nomp img { filter: grayscale(0.6) brightness(0.6) sepia(1) hue-rotate(180deg); }
.hb-slot.empty img { filter: grayscale(1) brightness(0.5); }
.hb-bag { position: relative; width: 52px; height: 52px; margin-left: 6px; background: #0c0703; border: 1px solid #6a5028; border-radius: 4px; cursor: pointer; padding: 6px; }
.hb-bag img { width: 100%; height: 100%; }
.hb-bag kbd { position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); font-size: 10px; background: none; border: 0; color: #d8c8a8; }
#expRow { display: flex; align-items: center; gap: 8px; width: 560px; }
#expLv { font-family: var(--head); font-size: 13px; color: #f0e2c4; text-shadow: 0 1px 3px #000; white-space: nowrap; }
.exp-bar { position: relative; flex: 1; height: 12px; background: rgba(8,4,2,.85); border: 1px solid #4a3418; border-radius: 6px; overflow: hidden; }
.exp-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, #e8b850, #8a5a10); transition: width .3s; }
.exp-bar span { position: relative; display: block; text-align: center; font-size: 10px; line-height: 10px; font-weight: 600; text-shadow: 0 0 2px #000, 0 0 2px #000; }
#castbar { position: relative; width: 360px; height: 20px; background: #0a0604; border: 1px solid var(--gold2); border-radius: 4px; overflow: hidden; }
.cb-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #7a4a10, #ffd060); }
#castbar span { position: relative; display: block; text-align: center; font-size: 12px; line-height: 18px; font-style: italic; text-shadow: 0 0 3px #000, 0 0 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }

#actions { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 6px; }
.act-btn { position: relative; width: 70px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: transparent; border: 0; color: #f0e2c4; cursor: pointer; text-shadow: 0 1px 3px #000; }
.act-btn .act-emoji { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; font-size: 22px; border-radius: 50%; background: radial-gradient(circle, #3a2610, #120a04); border: 2px solid #8a6a38; box-shadow: 0 0 0 1px #000, 0 4px 10px #000; }
.act-btn img { width: 48px; height: 48px; border-radius: 50%; padding: 7px; background: radial-gradient(circle, #3a2610, #120a04); border: 2px solid #8a6a38; box-shadow: 0 0 0 1px #000, 0 4px 10px #000; }
.act-btn:hover img { border-color: #e8c46a; }
.act-btn.on img { border-color: #ffd060; box-shadow: 0 0 14px #ffb020; }
.act-btn span { font-family: var(--head); font-size: 13px; }
.act-btn kbd { font-size: 10px; }

#notices { position: absolute; top: 162px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.notice { font-family: var(--head); font-size: 15px; padding: 4px 16px; background: rgba(10, 6, 3, 0.75); border-radius: 4px; text-shadow: 0 1px 3px #000; transition: opacity 0.5s, transform 0.5s; color: #fff; }
.notice.out { opacity: 0; transform: translateY(-10px); }
.n-warn { color: #ff8a6a; }
.n-good { color: #9aff9a; }
.n-quest { color: #ffe060; border: 1px solid #8a6a20; }
.n-level { color: #ffe060; font-size: 18px; }
#lootFeed { position: absolute; left: 14px; bottom: 272px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; pointer-events: none; }
.loot { display: flex; align-items: center; gap: 6px; font-size: 13px; background: rgba(10, 6, 3, 0.7); padding: 2px 10px; border-radius: 4px; transition: opacity 0.6s; text-shadow: 0 1px 2px #000; }
.loot img { width: 22px; height: 22px; }
.loot.out { opacity: 0; }
.lf-exp { color: #9aff6a; }
.lf-gold { color: #ffd86a; }
#deathScreen, #disconnect { position: fixed; inset: 0; background: radial-gradient(circle, rgba(40, 0, 0, 0.5), rgba(0, 0, 0, 0.85)); display: flex; align-items: center; justify-content: center; z-index: 50; }
.death-box { text-align: center; }
.death-box h2 { font-family: var(--head); font-size: 36px; color: #e8402a; margin: 0 0 6px; text-shadow: 0 0 20px #a00; }
.death-box p { color: var(--dim); margin-bottom: 18px; }

.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; max-height: 470px; overflow-y: auto; }
.cx-cell { background: #120a06; border: 1px solid #3a2a18; border-radius: 5px; padding: 6px 4px; text-align: center; font-size: 11.5px; }
.cx-cell img { width: 52px; height: 52px; display: block; margin: 0 auto 3px; }
.cx-cell canvas { width: 92px; height: 100px; display: block; margin: 0 auto; }
.cx-cell small { color: var(--dim); }
.cx-cell.boss { border-color: #a03a6a; }

/* ================= Windows ================= */
#windows { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.win { position: absolute; pointer-events: auto; background: var(--panel); border: 1px solid var(--gold2); border-radius: 6px; box-shadow: 0 0 0 1px #000, 0 12px 40px rgba(0, 0, 0, 0.75); max-width: calc(100vw - 20px); max-height: calc(100vh - 20px); display: flex; flex-direction: column; }
.win-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 14px; background: linear-gradient(180deg, #7a2a14, #3e140a); border-bottom: 1px solid var(--gold2); border-radius: 5px 5px 0 0; cursor: move; font-family: var(--head); color: #ffe9b8; font-size: 15px; letter-spacing: 1px; }
.win-x { background: none; border: 0; color: #ffe9b8; font-size: 15px; cursor: pointer; padding: 0 6px; }
.win-x:hover { color: #fff; }
.win-body { padding: 10px; overflow: auto; }
.tabs { display: flex; gap: 3px; margin-bottom: 8px; border-bottom: 1px solid #4a3420; flex-wrap: wrap; }
.tabs button { background: #1a100a; border: 1px solid #4a3420; border-bottom: 0; color: var(--dim); padding: 5px 14px; border-radius: 4px 4px 0 0; cursor: pointer; font-family: var(--head); font-size: 13px; }
.tabs.small button { padding: 3px 10px; font-size: 12px; }
.tabs button.on { color: var(--gold); background: #2e1e0e; }
.empty { color: var(--dim); text-align: center; padding: 20px; font-size: 13px; }

/* ตัวละคร */
.char-title { text-align: center; font-family: var(--head); margin-bottom: 6px; }
.char-title b { color: var(--gold); }
.char-row { display: flex; gap: 10px; justify-content: center; align-items: flex-start; }
.eq-col { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.eq-slot { width: 56px; height: 56px; border: 1px solid #5a4024; background: #0e0804; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #6a5838; cursor: default; }
.eq-slot.filled { cursor: pointer; border-color: var(--gold2); }
.eq-slot.filled:hover { box-shadow: 0 0 8px var(--gold2); }
.eq-slot.tat { border-style: dashed; }
.eq-slot img { width: 100%; height: 100%; border-radius: 4px; }
.char-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.char-preview { border: 1px solid var(--line); border-radius: 6px; }
.char-btns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: 220px; }
.stat-row { display: flex; gap: 12px; margin-top: 10px; }
.stats { flex: 1; background: #120a06; border: 1px solid #3a2a18; border-radius: 5px; padding: 6px 10px; }
.st-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; border-bottom: 1px dotted #3a2a18; }
.st-k { width: 88px; font-family: var(--head); color: var(--gold); white-space: nowrap; }
.st-k small { font-family: var(--body, inherit); font-size: 11px; color: var(--dim, #b8ab90); }
.st-row b { width: 34px; text-align: right; }
.st-b { color: #7affb0; font-size: 12px; flex: 1; }
.st-plus { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--gold); background: #3a2410; color: var(--gold); cursor: pointer; font-weight: 700; line-height: 1; }
.st-points { margin-top: 6px; font-size: 13px; color: #ffe060; }
.derived { flex: 1.2; background: #120a06; border: 1px solid #3a2a18; border-radius: 5px; padding: 6px 10px; font-size: 12.5px; }
.derived div { display: flex; justify-content: space-between; padding: 1.5px 0; border-bottom: 1px dotted #2a1e10; }
.derived span { color: var(--dim); }
.tat-info { margin-top: 10px; background: #120a06; border: 1px solid #3a2a18; border-radius: 5px; padding: 8px 10px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.tat-skills { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: #1e140a; border: 1px solid #5a4024; border-radius: 14px; padding: 2px 10px 2px 2px; font-size: 12px; cursor: grab; }
.chip img { width: 22px; height: 22px; border-radius: 50%; }

/* กระเป๋า */
.inv-grid { display: grid; grid-template-columns: repeat(6, 56px); gap: 5px; justify-content: center; max-height: 390px; overflow-y: auto; padding: 2px; }
.inv-cell { position: relative; width: 56px; height: 56px; background: #0e0804; border: 1px solid #3a2a18; border-radius: 4px; }
.inv-cell img { width: 100%; height: 100%; border-radius: 3px; cursor: pointer; }
.inv-cell b { position: absolute; right: 3px; bottom: 1px; font-size: 11.5px; text-shadow: 0 0 2px #000, 0 0 2px #000, 0 0 2px #000; }
.inv-cell.locked img { filter: grayscale(0.7) brightness(0.6); }
.inv-cell.locked::after { content: ''; position: absolute; inset: 0; background: rgba(160, 20, 10, 0.18); pointer-events: none; }
.inv-foot { display: flex; justify-content: space-between; margin-top: 8px; padding: 6px 4px 0; border-top: 1px solid #3a2a18; font-size: 13px; }
.gold { color: #ffd86a; font-family: var(--head); }
.ctx-menu { position: fixed; z-index: 200; background: #1a100a; border: 1px solid var(--gold2); border-radius: 4px; display: flex; flex-direction: column; min-width: 140px; box-shadow: 0 6px 20px #000; }
.ctx-menu button { background: none; border: 0; color: var(--text); text-align: left; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.ctx-menu button:hover { background: #3a2410; color: var(--gold); }

/* สกิล */
.skill-head { font-size: 13px; margin-bottom: 6px; color: var(--gold); }
.skill-list { max-height: 440px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; }
.tier-sep { text-align: center; font-family: var(--head); font-size: 13px; margin: 6px 0 2px; }
.sk-row { display: flex; align-items: center; gap: 10px; padding: 4px 6px; background: #120a06; border: 1px solid #2e2010; border-radius: 5px; opacity: 0.6; }
.sk-row.known { opacity: 1; border-color: #5a4024; }
.sk-row.locked .sk-meta { color: #b86a5a; }
.sk-row img { width: 44px; height: 44px; border-radius: 4px; flex-shrink: 0; }
.sk-row.known img { cursor: grab; }
.sk-row:not(.known) img { filter: grayscale(0.8) brightness(0.7); }
.sk-info { flex: 1; min-width: 0; }
.sk-name { font-family: var(--head); font-size: 14px; display: flex; gap: 8px; align-items: baseline; }
.sk-tier { font-size: 11px; }
.sk-meta { font-size: 11.5px; color: var(--dim); }
.sk-how { font-size: 11.5px; color: var(--dim); text-align: right; min-width: 90px; }

/* เควส */
.q-wrap { display: flex; gap: 10px; min-height: 380px; }
.q-list { width: 210px; background: #120a06; border: 1px solid #3a2a18; border-radius: 5px; padding: 4px; overflow-y: auto; max-height: 460px; }
.q-group { font-family: var(--head); font-size: 12px; color: var(--gold2); padding: 6px 6px 2px; }
.q-item { display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; padding: 5px 8px; border-radius: 4px; cursor: pointer; }
.q-item span { color: var(--dim); font-size: 11px; white-space: nowrap; }
.q-item.on { background: #3a2410; color: var(--gold); }
.q-item.done { color: #7affb0; }
.q-item.avail { cursor: default; color: #ffd86a; }
.q-detail { flex: 1; font-size: 13px; overflow-y: auto; max-height: 460px; }
.q-detail h3 { font-family: var(--head); color: var(--gold); margin: 0 0 4px; font-weight: 500; }
.q-detail h4 { font-family: var(--head); color: var(--gold2); margin: 10px 0 4px; font-weight: 500; font-size: 13px; }
.q-type { font-size: 11.5px; color: var(--dim); }
.q-desc { line-height: 1.65; background: #e8d8b0; color: #2a1a0a; padding: 10px 12px; border-radius: 4px; font-size: 13.5px; }
.q-obj { padding: 2px 0; }
.q-obj.ok { color: #7affb0; }
.q-rew { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.q-rew > span { background: #1e140a; border: 1px solid #4a3420; border-radius: 4px; padding: 2px 8px; font-size: 12px; }
.rw-item { display: inline-flex; align-items: center; gap: 4px; }
.rw-item img { width: 22px; height: 22px; }
.q-actions { margin-top: 14px; text-align: right; }

/* แผนที่ */
.map-title { font-family: var(--head); color: var(--gold); margin-bottom: 6px; }
.map-canvas { width: 100%; border: 1px solid var(--line); border-radius: 4px; cursor: crosshair; }
.map-legend { display: flex; gap: 14px; font-size: 12px; margin-top: 6px; flex-wrap: wrap; }

/* บทสนทนา */
.dlg { display: flex; gap: 12px; }
.dlg-left { text-align: center; width: 150px; flex-shrink: 0; }
.npc-portrait { border: 1px solid var(--gold2); border-radius: 6px; }
.dlg-name { font-family: var(--head); color: var(--gold); font-size: 16px; }
.dlg-title { font-size: 12px; color: var(--dim); }
.dlg-right { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dlg-text { background: linear-gradient(180deg, #efe2c2, #dcc89c); color: #2a1a0a; border-radius: 5px; padding: 10px 14px; font-size: 14px; line-height: 1.65; max-height: 260px; overflow-y: auto; border: 1px solid #8a6a38; }
.dlg-text p { margin: 0 0 4px; white-space: pre-wrap; }
.dlg-quest { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #8a6a38; font-size: 13px; }
.dlg-quest .q-rew > span { background: #f8ecd0; color: #2a1a0a; border-color: #b89a68; }
.dlg-quest .chip { background: #f8ecd0; color: #2a1a0a; }
.dlg-opts { display: flex; flex-direction: column; gap: 4px; }
.dlg-opt { text-align: left; background: #1e140a; border: 1px solid #4a3420; color: var(--text); padding: 7px 12px; border-radius: 4px; cursor: pointer; font-size: 13.5px; }
.dlg-opt:hover { border-color: var(--gold); color: var(--gold); background: #2e1e0e; }
.dlg-opt.quest { color: #ffe060; }

/* ร้านค้า */
.shop-head { display: flex; justify-content: space-between; font-family: var(--head); color: var(--gold); margin-bottom: 8px; font-size: 13.5px; gap: 10px; }
.shop-list { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow-y: auto; }
.shop-row { display: flex; align-items: center; gap: 8px; background: #120a06; border: 1px solid #2e2010; border-radius: 5px; padding: 4px 6px; }
.shop-row img { width: 40px; height: 40px; border-radius: 4px; }
.shop-row.locked { opacity: 0.55; }
.shop-info { flex: 1; min-width: 0; font-size: 13px; }
.shop-info .tt-dim { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-price { color: #ffd86a; font-family: var(--head); min-width: 60px; text-align: right; }
.qty { width: 50px; background: #0a0604; border: 1px solid #4a3420; color: var(--text); padding: 3px; border-radius: 3px; }
.frag-bar { width: 70px; height: 8px; background: #0a0604; border: 1px solid #3a2a18; border-radius: 4px; overflow: hidden; }
.frag-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8a5a10, #ffd060); }

/* ตั้งค่า */
.help h4 { font-family: var(--head); color: var(--gold); margin: 4px 0 8px; font-weight: 500; }
.keys { display: grid; grid-template-columns: 1fr; gap: 4px; font-size: 13px; }
.keys div { display: flex; gap: 10px; align-items: center; }
.keys kbd { min-width: 70px; text-align: center; font-size: 11px; }
.set-btns { margin-top: 14px; text-align: center; }

/* Tooltip */
#tooltip { position: fixed; z-index: 300; display: none; pointer-events: none; max-width: 300px; background: rgba(14, 9, 5, 0.97); border: 1px solid var(--gold2); border-radius: 5px; padding: 8px 11px; font-size: 12.5px; box-shadow: 0 6px 24px #000; line-height: 1.5; }
.tt-title { font-family: var(--head); font-size: 15px; color: var(--gold); }
.tt-sub { font-size: 11.5px; color: var(--dim); margin-bottom: 4px; }
.tt-stats { color: #9affb0; margin: 4px 0; }
.tt-desc { color: #e8dcc0; margin: 4px 0; }
.tt-chant { color: #ffd88a; font-style: italic; margin-top: 4px; }
.tt-skill { color: #6ad8ff; margin: 4px 0; }
.tt-price { color: #ffd86a; font-size: 11.5px; margin-top: 4px; }
.tt-bad { color: #ff6a5a; font-size: 12px; }
.tt-learn { color: #ffb86a; margin-top: 4px; font-size: 12px; }
.tt-hint { color: #8ab8ff; font-size: 11px; margin-top: 4px; }
.tt-grid { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 0 8px; font-size: 12px; margin: 4px 0; }
.tt-grid span { color: var(--dim); }

/* ส่งเควสสำเร็จ */
.quest-complete { position: fixed; left: 50%; top: 26%; transform: translateX(-50%); z-index: 100; text-align: center; background: radial-gradient(ellipse, rgba(40, 20, 6, 0.95), rgba(10, 6, 3, 0.9)); border: 1px solid var(--gold); border-radius: 8px; padding: 14px 30px; box-shadow: 0 0 40px rgba(232, 196, 106, 0.3); transition: opacity 0.7s; pointer-events: none; animation: qc-in 0.4s ease-out; }
.quest-complete.out { opacity: 0; }
@keyframes qc-in { from { transform: translateX(-50%) scale(0.7); opacity: 0; } }
.qc-title { font-family: var(--head); font-size: 26px; color: var(--gold); text-shadow: 0 0 14px rgba(232, 196, 106, 0.6); }
.qc-name { font-size: 15px; margin-bottom: 8px; }
.qc-rew { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; font-size: 13px; }
.qc-rew span { display: inline-flex; align-items: center; gap: 4px; }
.qc-rew img { width: 24px; height: 24px; }
.qc-skill { color: #ffe060; }

/* ---------- จัดวาง HUD ตามความกว้างจอ (ไม่ให้ฮอตบาร์ทับแชท/รายการของที่ได้) ---------- */
/* จอกลาง: แชทแคบลง ฮอตบาร์ขยับไปต่อท้ายแชทแทนการอยู่กลางจอ ปุ่มลัดเป็น 2x2 */
@media (max-width: 1760px) {
  #chat { width: 380px; height: 220px; }
  #hotbarWrap { left: 408px; transform: none; }
  .hb-slot, .hb-weapon, .hb-bag { width: 46px; height: 46px; }
  #expRow { width: 100%; }
  #actions { display: grid; grid-template-columns: repeat(2, 64px); gap: 2px 6px; }
  .act-btn { width: 64px; }
  .act-btn img, .act-btn .act-emoji { width: 40px; height: 40px; padding: 6px; }
  #lootFeed { bottom: 242px; }
}
/* จอแคบ: ยกแชทขึ้นไปเหนือฮอตบาร์ แล้วให้ฮอตบาร์กลับไปอยู่กลางจอ */
@media (max-width: 1340px) {
  #chat { bottom: 118px; height: 170px; width: 340px; }
  #hotbarWrap { left: 50%; transform: translateX(-50%); }
  #sidePanel #spBody { max-height: 200px; }
  #lootFeed { bottom: 294px; }
  #lootFeed .loot:nth-last-child(n+4) { display: none; }
}
@media (max-width: 1080px) {
  .hb-slot, .hb-weapon, .hb-bag { width: 40px; height: 40px; }
  #topMenu { right: 14px; top: 50px; }
  .menu-btn { width: 50px; }
  .menu-btn span { font-size: 11px; }
  #minimap { top: 150px; width: 230px; }
  #mmCanvas { width: 216px; height: 168px; }
}
@media (max-width: 900px) {
  #sidePanel { display: none; }
  #actions { display: none; }
  #chat { width: 280px; height: 140px; }
  #lootFeed { bottom: 264px; }
}

/* ================= งานภาพ UI จาก client/assets (เปิดเมื่อโหลดภาพได้) ================= */
#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--head); color: var(--gold); font-size: 18px; z-index: 30; background: #0b0705; }
.logo-img { display: block; width: min(620px, 82vw, 60vh); height: auto; margin: 0 auto -10px; filter: drop-shadow(0 6px 18px #000); }
body.ui-art #screens .login-box { width: min(520px, 100%); }
body.ui-art #screens .login-box, body.ui-art #screens .select-box, body.ui-art #screens .create-box {
  background: none; box-shadow: none; border-radius: 0;
  border: 44px solid transparent; border-image: var(--ui-panel) 96 fill / 44px stretch;
  padding: 6px 14px;
}
body.ui-art #screens .story { background: rgba(10,6,3,.72); }
body.ui-art #screens .btn {
  background: var(--ui-btn-dark) center / 100% 100% no-repeat; border: 0; box-shadow: none; border-radius: 0;
  min-width: 170px; padding: 13px 34px 15px; color: #f6e6c4; text-shadow: 0 1px 2px #000, 0 0 6px #000; filter: none;
}
body.ui-art #screens .btn:hover { background-image: var(--ui-btn-dark-h); filter: brightness(1.08); }
body.ui-art #screens .btn.gold { background-image: var(--ui-btn-gold); color: #3a1e06; text-shadow: 0 1px 0 rgba(255,240,190,.6); font-weight: 600; }
body.ui-art #screens .btn.gold:hover { background-image: var(--ui-btn-gold-h); }
body.ui-art #screens .btn.danger { filter: sepia(1) hue-rotate(-30deg) saturate(2.2) brightness(.85); }
body.ui-art #screens .btn.sm { min-width: 110px; padding: 8px 20px 10px; font-size: 13px; }
body.ui-art #screens input {
  background: none !important; border-radius: 0 !important;
  /* ภาพถูกตัดขอบใสออกตอนโหลด (main.js) แล้วยืดเป็นกรอบ 9 ช่อง */
  border: 12px solid transparent !important; border-image: var(--ui-input) 14 24 14 24 fill / 12px 18px stretch !important;
  height: 54px; padding: 0 12px !important; font-size: 19px !important; line-height: 30px;
}
body.ui-art #screens input::placeholder { color: #8a7a60; font-size: 15px; }
body.ui-art #screens .login-box label { font-size: 15px; color: #e8d8b8; margin-bottom: 14px; text-shadow: 0 1px 2px #000; }
body.ui-art #screens .login-box input { margin-top: 6px; }
body.ui-art #screens .create-opts input { height: 52px; font-size: 17px !important; }
body.ui-art #screens .cs-frame { background: var(--ui-slot) center / 100% 100% no-repeat; border: 0; box-shadow: none; border-radius: 0; }
/* ช่องหน้าต่างของกรอบทองอยู่ช่วง ~28%-80% ของความสูงภาพ */
body.ui-art #screens .cs-frame canvas { top: 24%; height: 56%; }
body.ui-art #screens .char-slot.on .cs-frame { background-image: var(--ui-slot-on); filter: drop-shadow(0 0 12px rgba(255,200,90,.5)); box-shadow: none; }
body.ui-art #screens .char-slot.is-empty .cs-frame { background-image: var(--ui-slot-empty); }
body.ui-art #screens .char-slot.is-empty .cs-plus { visibility: hidden; }
body.ui-art #screens .char-slot:hover .cs-frame { filter: brightness(1.12); }
body.ui-art #screens .char-slot.on:hover .cs-frame { filter: drop-shadow(0 0 12px rgba(255,200,90,.5)) brightness(1.08); }
body.ui-art #screens .select-box h3 { font-size: 22px; }
body.ui-art #screens .stepper button { width: 40px; height: 40px; padding: 0; border: 0; background: var(--ui-arrow-l) center / contain no-repeat; color: transparent; }
body.ui-art #screens .stepper button:last-child { background-image: var(--ui-arrow-r); }
body.ui-art #screens .stepper button:hover { filter: brightness(1.25); }
body.ui-art #screens .swatches i { position: relative; border-color: transparent; }
body.ui-art #screens .swatches i.on { box-shadow: none; }
body.ui-art #screens .swatches i.on::after { content: ''; position: absolute; inset: -8px; background: var(--ui-ring) center / contain no-repeat; }
body.ui-art #screens .create-prev canvas { border: 0; }

/* ================= โหมดมือถือ ================= */
#mobileCtl { display: none; }
body.mobile #mobileCtl { display: block; }
canvas#game { touch-action: none; }
body.mobile kbd { display: none !important; }
body.mobile #hotbar { display: none; }
body.mobile #hotbarWrap { left: 50%; transform: translateX(-50%); bottom: 4px; width: 40vw; }
body.mobile #expRow { width: 100%; }
body.mobile #topMenu { top: 6px; right: 150px; gap: 0; }
body.mobile .menu-btn { width: 42px; }
body.mobile .menu-btn span { display: none; }
body.mobile .menu-btn img { width: 28px; height: 28px; }
body.mobile #clock { top: 10px; }
body.mobile #minimap { top: 56px; width: 210px; }
body.mobile #mmCanvas { width: 196px; height: 118px; }
body.mobile .mm-foot { font-size: 11px; }
body.mobile #mmWorld { display: none; }
body.mobile #playerFrame { transform: scale(.82); transform-origin: top left; }
body.mobile #sidePanel { top: 112px; width: 280px; }
body.mobile #actions { left: 12px; right: auto; bottom: auto; top: 160px; display: flex; gap: 2px; }
body.mobile .act-btn { width: 58px; }
body.mobile .act-btn img, body.mobile .act-btn .act-emoji { width: 38px; height: 38px; padding: 6px; font-size: 18px; }
body.mobile .act-btn span { font-size: 11px; }
body.mobile #lootFeed { left: auto; right: 14px; bottom: auto; top: 262px; align-items: flex-end; }
body.mobile #lootFeed .loot:nth-last-child(n+3) { display: none; }
body.mobile #sidePanel:not(.folded) ~ #actions { display: none; }
/* แชท: ย่อเป็นแถบโปร่งแสงกลางล่าง แตะ 💬 เพื่อพิมพ์ */
body.mobile #chat { left: 50%; transform: translateX(-50%); right: auto; bottom: 26px; width: min(440px, 42vw); height: 112px; background: rgba(10, 6, 3, .45); border-color: transparent; box-shadow: none; }
body.mobile #chat .chat-tabs, body.mobile #chat .chat-input { display: none; }
body.mobile #chat #chatLog { font-size: 12px; padding: 4px 8px; }
body.mobile #chat.chat-open { height: 230px; background: rgba(14, 9, 5, .92); border-color: #6a5028; bottom: 26px; }
body.mobile #chat.chat-open .chat-tabs, body.mobile #chat.chat-open .chat-input { display: flex; }
#mChatBtn { position: absolute; left: calc(50% - min(220px, 21vw) - 52px); bottom: 30px; width: 44px; height: 44px; border-radius: 50%; border: 2px solid #8a6a38; background: radial-gradient(circle, #3a2610, #120a04); font-size: 20px; cursor: pointer; pointer-events: auto; }
/* จอย 8 ทิศ */
#joy { position: absolute; left: 34px; bottom: 34px; width: 170px; height: 170px; border-radius: 50%; pointer-events: auto; touch-action: none; }
.joy-ring { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(40,26,12,.55), rgba(10,6,3,.75)); border: 2px solid rgba(200,160,80,.6); box-shadow: 0 0 0 1px #000, inset 0 0 20px rgba(0,0,0,.6); }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 70px; height: 70px; margin: -35px 0 0 -35px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f0c860, #8a5a10); border: 2px solid #ffe08a; box-shadow: 0 4px 12px #000; transition: transform .05s; pointer-events: none; }
.joy-arrow { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px; font-style: normal; text-align: center; line-height: 20px; color: rgba(255,225,150,.7); font-size: 13px; transform: rotate(var(--a)) translateY(-70px) rotate(calc(-1 * var(--a))); pointer-events: none; }
/* ปุ่มโจมตี + สกิล (ขวาล่าง เรียงเป็นวง) */
#mSkills { position: absolute; right: 20px; bottom: 20px; width: 330px; height: 340px; pointer-events: none; }
#mSkills button { position: absolute; pointer-events: auto; border-radius: 50%; padding: 0; cursor: pointer; overflow: hidden; touch-action: manipulation; }
.m-atk { right: 0; bottom: 0; width: 96px; height: 96px; border: 3px solid #e8c46a; background: radial-gradient(circle, #6a2a10, #1a0804); box-shadow: 0 0 0 2px #000, 0 6px 16px #000; }
.m-atk img { width: 60%; height: 60%; margin-top: 4px; }
.m-skill { width: 58px; height: 58px; border: 2px solid #a08040; background: #0c0703; box-shadow: 0 0 0 1px #000, 0 4px 10px #000;
  /* วงโค้งร่วมศูนย์กับปุ่มโจมตี: วงใน 3 ปุ่ม (0°/45°/90°) วงนอก 5 ปุ่ม (0°-90° ทุก 22.5°) — 0° = ซ้าย, 90° = บน */
  right: calc(19px + cos(var(--ang)) * var(--rad)); bottom: calc(19px + sin(var(--ang)) * var(--rad)); }
.m-skill[style*="--n:0"] { --rad: 116px; --ang: 0deg; }
.m-skill[style*="--n:1"] { --rad: 116px; --ang: 45deg; }
.m-skill[style*="--n:2"] { --rad: 116px; --ang: 90deg; }
.m-skill[style*="--n:3"] { --rad: 202px; --ang: 0deg; }
.m-skill[style*="--n:4"] { --rad: 202px; --ang: 22.5deg; }
.m-skill[style*="--n:5"] { --rad: 202px; --ang: 45deg; }
.m-skill[style*="--n:6"] { --rad: 202px; --ang: 67.5deg; }
.m-skill[style*="--n:7"] { --rad: 202px; --ang: 90deg; }
.m-skill img, .m-pot img { width: 100%; height: 100%; display: block; }
.m-skill.empty, .m-pot.empty { opacity: .35; }
.m-skill .cd, .m-pot .cd { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-family: var(--head); color: #fff; font-size: 16px; text-shadow: 0 0 3px #000; border-radius: 50%; }
.m-potrow { position: absolute; right: 4px; bottom: 290px; display: flex; gap: 8px; pointer-events: auto; }
#mSkills .m-potrow button { position: relative; }
.m-pot { width: 50px; height: 50px; border: 2px solid #8a6a38; background: #0c0703; box-shadow: 0 0 0 1px #000, 0 4px 10px #000; }
.m-potcfg, .hb-potcfg { width: 50px; height: 50px; border: 2px solid #6a5028; background: radial-gradient(circle, #2a1a0c, #0c0703); font-size: 20px; line-height: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #8a7a60; box-shadow: 0 0 0 1px #000, 0 4px 10px #000; }
.m-potcfg i, .hb-potcfg i { font-style: normal; font-size: 8.5px; font-family: var(--head); letter-spacing: .5px; }
.m-potcfg.on, .hb-potcfg.on { border-color: #6aff8a; color: #9aff9a; box-shadow: 0 0 0 1px #000, 0 0 12px rgba(100,255,140,.45); }
.hb-potcfg { border-radius: 4px; margin-left: 4px; cursor: pointer; width: 46px; height: 46px; }
.m-pot b { position: absolute; right: 6px; bottom: 2px; font-size: 11px; text-shadow: 0 0 2px #000, 0 0 2px #000; }
.m-tgt { width: 44px; height: 44px; right: 284px; bottom: 6px; border: 2px solid #8a6a38; background: radial-gradient(circle, #3a2610, #120a04); color: #ffe08a; font-size: 22px; }

/* ปุ่มสลับ PC / มือถือ — ตำแหน่งเดียวกันทุกโหมด (ขวาของกรอบตัวละคร) */
#deviceToggle { position: absolute; left: 362px; top: 14px; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 8px;
  border: 1px solid #c8a050; border-radius: 17px; background: linear-gradient(180deg, rgba(58,38,16,.95), rgba(18,10,4,.95)); color: #f6e6c4;
  font-family: var(--head); font-size: 13px; white-space: nowrap; cursor: pointer; box-shadow: 0 0 0 1px #000, 0 4px 10px rgba(0,0,0,.7); pointer-events: auto; }
#deviceToggle:hover { border-color: #ffe08a; box-shadow: 0 0 0 1px #000, 0 0 12px rgba(255,200,90,.45); }
#deviceToggle .dt-ico { font-size: 17px; }

/* ป๊อปอัปตั้งค่ากินยาอัตโนมัติ */
#potionCfg { position: absolute; right: 50%; bottom: 140px; transform: translateX(50%); width: 300px; padding: 10px 14px 12px; z-index: 30; pointer-events: auto; }
body.mobile #potionCfg { right: auto; left: 50%; bottom: auto; top: 50%; transform: translate(-50%, -50%); }
.pc-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--head); color: var(--gold); font-size: 15px; margin-bottom: 6px; }
.pc-head button { background: none; border: 0; color: #f0e2c4; cursor: pointer; font-size: 14px; }
.pc-row { padding: 8px 0; border-bottom: 1px solid #3a2a18; }
.pc-toggle { display: flex; align-items: center; gap: 8px; font-family: var(--head); font-size: 15px; cursor: pointer; }
.pc-toggle input { width: 18px; height: 18px; accent-color: #6aff8a; }
.pc-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #cfc0a0; margin-top: 6px; }
.pc-line input[type=range] { flex: 1; accent-color: #e8c46a; }
.pc-line b { width: 36px; text-align: right; color: #fff; }
.pc-line select { flex: 1; background: #1a100a; color: var(--text); border: 1px solid #4a3418; border-radius: 3px; padding: 3px; font-size: 12.5px; }

/* จอเตี้ย (มือถือแนวนอน): ย่อชุดปุ่มสกิลไม่ให้ชนมินิแมพ */
@media (max-height: 640px) {
  body.mobile #mSkills { transform: scale(.82); transform-origin: bottom right; }
  body.mobile #joy { transform: scale(.85); transform-origin: bottom left; }
}

/* หน้าเลือกตัวละคร: พอดีหนึ่งจอ ไม่ต้องเลื่อน — โลโก้และช่องตัวละครย่อตามความสูงจอ */
.screen.select { height: 100vh; min-height: 0; overflow: hidden; gap: 6px; padding: 10px 16px; }
.screen.select .logo-img { width: auto; height: auto; max-width: min(520px, 70vw); max-height: 15vh; margin-bottom: 0; }
.screen.select .logo-sub { display: none; }
.screen.select .select-box h3 { margin-bottom: 6px; }
.screen.select .char-slots { --slot-w: max(120px, min(290px, 27vw, calc((88vh - 370px) / 1.5))); grid-template-columns: repeat(3, var(--slot-w)); gap: max(14px, 2vw); margin: 2px 0 10px; }
.screen.select .cs-info { min-height: 0; }
.screen.select .cs-name { font-size: clamp(15px, 2.2vh, 19px); }
.screen.select .cs-sub, .screen.select .cs-map { font-size: clamp(11.5px, 1.6vh, 13.5px); }
body.ui-art #screens .select .btn { min-width: 150px; padding: 11px 26px 13px; }

/* ช่องโจมตีปกติในฮอตบาร์ */
.hb-weapon { position: relative; }
.hb-weapon kbd { position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); font-size: 9px; background: none; border: 0; color: #d8c8a8; }
.hb-weapon:active { transform: scale(.94); }

/* ปุ่มสกิลมือถือ ขณะกดค้างเล็งเวทย์ลงพื้น */
.m-skill.aiming { border-color: #ffe08a !important; box-shadow: 0 0 0 2px #000, 0 0 18px rgba(255,220,120,.8) !important; transform: scale(1.12); }
#mSkills .m-skill { touch-action: none; }

/* ================= ต้นวิชา (skill tree) ================= */
.tabs button.mypath { box-shadow: inset 0 -2px 0 var(--gold); }
.sk-wrap { display: flex; gap: 10px; align-items: flex-start; }
.sk-tree-scroll { flex: 1; max-height: 470px; overflow: auto; background: radial-gradient(ellipse at top, rgba(60,40,18,.5), rgba(10,6,3,.6)); border: 1px solid #3a2a18; border-radius: 6px; padding: 6px 0; }
.sk-tree { position: relative; margin: 0 auto; }
.sk-lines { position: absolute; inset: 0; pointer-events: none; }
.sk-lines path { fill: none; stroke-width: 3; }
.sk-lines path.lock { stroke: #3a2c1c; stroke-dasharray: 4 4; }
.sk-lines path.open { stroke: #c8a050; filter: drop-shadow(0 0 3px rgba(255,200,90,.6)); }
.sk-lines path.done { stroke: #e8c46a; opacity: .75; }
.sk-node { position: absolute; width: 56px; text-align: center; cursor: pointer; }
.sk-node img { width: 52px; height: 52px; border-radius: 6px; border: 2px solid #3a2a18; display: block; margin: 0 auto; background: #000; }
.sk-node-name { font-size: 10.5px; line-height: 1.15; width: 110px; margin-left: -27px; color: #cfc0a0; text-shadow: 0 1px 2px #000; margin-top: 2px; }
.sk-node-lv { font-size: 9.5px; color: var(--dim); }
.sk-node.known img { border-color: #e8c46a; box-shadow: 0 0 10px rgba(232,196,106,.45); }
.sk-node.known .sk-node-name { color: #ffe9a8; }
.sk-node.ready img { border-color: #7affb0; animation: skpulse 1.6s infinite; }
@keyframes skpulse { 50% { box-shadow: 0 0 12px rgba(120,255,170,.6); } }
.sk-node.locked img, .sk-node.otherpath img { filter: grayscale(.85) brightness(.45); }
.sk-node.sel img { outline: 2px solid #fff; outline-offset: 2px; }
.sk-lock { position: absolute; top: 30px; left: 34px; font-style: normal; font-size: 14px; }
.sk-detail { width: 290px; flex-shrink: 0; background: #120a06; border: 1px solid #3a2a18; border-radius: 6px; padding: 8px 10px; max-height: 470px; overflow-y: auto; font-size: 12.5px; }
.sk-d-head { display: flex; gap: 8px; align-items: flex-start; }
.sk-d-head img { width: 44px; height: 44px; border-radius: 6px; flex-shrink: 0; }
.sk-req-t { font-family: var(--head); color: var(--gold2); margin: 8px 0 2px; }
.sk-req.ok { color: #7affb0; } .sk-req.no { color: #ff8a6a; } .sk-req.next { color: #cfc0a0; }
.sk-row.secret img { border: 1px solid #ffcf40; }
.secret-note { font-size: 12px; color: #ffd86a; background: rgba(60,40,4,.5); border: 1px solid #6a5020; border-radius: 5px; padding: 6px 8px; margin-bottom: 6px; line-height: 1.5; }

/* ================= สมุดภาพ: รายละเอียดมอนสเตอร์ ================= */
.cx-cell.mob { cursor: pointer; }
.cx-cell.mob:hover { border-color: var(--gold2); background: #1e140a; }
.md-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.md-title { font-family: var(--head); font-size: 20px; color: var(--gold); }
.md-boss { font-size: 12px; margin-left: 8px; padding: 1px 8px; border-radius: 10px; background: #6a1a2a; color: #ffb0c0; vertical-align: middle; }
.md-body { display: flex; gap: 14px; }
.md-left { width: 230px; flex-shrink: 0; text-align: center; }
.mob-big { background: radial-gradient(ellipse at 50% 85%, rgba(80,50,20,.6), rgba(10,6,3,.9)); border: 1px solid #4a3418; border-radius: 6px; }
.md-tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 6px; }
.md-tags span { font-size: 11.5px; background: #1e140a; border: 1px solid #4a3418; border-radius: 10px; padding: 1px 8px; }
.md-right { flex: 1; min-width: 0; }
.md-lore { background: linear-gradient(180deg, #efe2c2, #dcc89c); color: #2a1a0a; border-radius: 5px; padding: 8px 12px; font-size: 13.5px; line-height: 1.6; margin: 0 0 6px; }
.md h4 { font-family: var(--head); color: var(--gold2); margin: 8px 0 4px; font-weight: 500; }
.md-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 10px; font-size: 12.5px; }
.md-stats div { display: flex; justify-content: space-between; border-bottom: 1px dotted #3a2a18; }
.md-stats span { color: var(--dim); }
.md-weak, .md-where { font-size: 12.5px; margin-top: 6px; color: #cfc0a0; }
.md-rare { font-size: 12px; margin-top: 6px; color: #ffd86a; }
.md-mobskill { font-size: 12.5px; margin-top: 6px; color: #ffb0a0; padding: 6px 8px; background: rgba(90,20,10,.25); border: 1px solid rgba(200,80,50,.35); border-radius: 6px; }
.md-drops { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 10px; max-height: 190px; overflow-y: auto; }
.md-drop { display: flex; align-items: center; gap: 6px; font-size: 12.5px; background: #120a06; border: 1px solid #2e2010; border-radius: 4px; padding: 3px 6px; }
.md-drop img { width: 26px; height: 26px; border-radius: 3px; }
.md-drop span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-drop small { color: var(--dim); font-size: 10.5px; white-space: nowrap; }
.md-drop b { color: #7affb0; font-family: var(--head); }
.md-drop.eq span { color: var(--dim); }

/* บัฟใกล้หมด: กะพริบเตือน */
.buff.ending { animation: buffend .6s infinite alternate; }
@keyframes buffend { to { opacity: .45; } }
.buff span { font-size: 9px; }

/* ---------- ลงอาคม ---------- */
.ak-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 14px; }
.ak-h { font-family: var(--head); color: var(--gold); margin: 10px 0 6px; font-size: 14px; }
.ak-h:first-child { margin-top: 0; }
.ak-media { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ak-card { display: flex; gap: 8px; align-items: flex-start; text-align: left; padding: 8px; background: rgba(0,0,0,.3); border: 1px solid #4a3a24; color: inherit; cursor: pointer; border-radius: 6px; }
.ak-card img { width: 40px; height: 40px; }
.ak-card b { display: block; color: #f0e0b8; }
.ak-card small { display: block; font-size: 11px; color: #b8a888; line-height: 1.35; }
.ak-card.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset, 0 0 12px rgba(255,200,90,.25); }
.ak-ess { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ak-e { position: relative; display: flex; flex-direction: column; align-items: center; padding: 6px 4px; background: rgba(0,0,0,.3); border: 1px solid #3a2e1e; color: inherit; cursor: pointer; border-radius: 6px; font-size: 12px; }
.ak-e img { width: 30px; height: 30px; }
.ak-e small { font-size: 10px; color: #a89878; }
.ak-e i { position: absolute; top: 3px; right: 5px; font-style: normal; font-size: 10px; color: #c8b890; }
.ak-e.low { opacity: .55; }
.ak-e.on { border-color: var(--gold); opacity: 1; background: rgba(90,60,20,.45); }
.ak-seq { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 6px 10px; font-size: 24px; letter-spacing: 2px; color: #ffe6a8; background: rgba(60,10,10,.35); border: 1px dashed #8a3a2a; border-radius: 6px; text-shadow: 0 0 8px rgba(255,120,60,.5); }
.ak-seq .tt-dim { font-size: 13px; letter-spacing: 0; }
.ak-seq-btns { display: flex; gap: 4px; }
.ak-syl { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 6px; }
.ak-s { display: flex; flex-direction: column; align-items: center; padding: 4px 0; background: rgba(0,0,0,.35); border: 1px solid #3a2e1e; color: #f0e0b8; cursor: pointer; border-radius: 5px; }
.ak-s b { font-size: 17px; }
.ak-s small { font-size: 9px; color: #a89878; }
.ak-s.lock { opacity: .35; cursor: not-allowed; }
.ak-s.tag-harm, .ak-s.tag-fire { border-color: #8a2a1a; } .ak-s.tag-heal { border-color: #2a7a4a; } .ak-s.tag-guard { border-color: #6a6a7a; }
.ak-s.tag-swift { border-color: #2a6a8a; } .ak-s.tag-holy { border-color: #a08a2a; } .ak-s.tag-charm { border-color: #8a2a6a; } .ak-s.tag-all { border-color: #7a5a3a; }
.ak-hearts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; font-size: 11px; align-items: center; }
.ak-heart { background: rgba(80,50,10,.35); border: 1px solid #6a4a1a; color: #f0d890; padding: 2px 6px; border-radius: 10px; cursor: pointer; font-size: 11px; }
.ak-heart.lock { opacity: .4; cursor: not-allowed; }
.ak-right { background: rgba(0,0,0,.25); border: 1px solid #3a2e1e; border-radius: 8px; padding: 10px; position: relative; }
.ak-wait { color: #a89878; padding: 20px 0; text-align: center; }
.ak-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; }
.ak-grid span { color: #a89878; }
.ak-out { margin: 8px 0; padding: 8px; background: rgba(255,220,140,.06); border-left: 3px solid var(--gold); font-size: 13px; color: #f0e0b8; line-height: 1.5; }
.ak-cost { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }
.ak-cost span { display: inline-flex; align-items: center; gap: 3px; }
.ak-cost img { width: 18px; height: 18px; }
.ak-good { color: #8fe08a; } .ak-bad { color: #ff7a6a !important; }
.ak-name { width: 100%; box-sizing: border-box; padding: 7px 8px; background: #120c08; border: 1px solid #5a4428; color: #ffe6b0; border-radius: 4px; font-size: 14px; }
.ak-go { width: 100%; margin-top: 10px; font-size: 16px; padding: 9px; }
.ak-go[disabled] { opacity: .45; cursor: not-allowed; }
.ak-result { margin-top: 10px; padding: 8px; border-radius: 6px; font-size: 13px; }
.ak-result.ok { background: rgba(60,120,40,.25); border: 1px solid #5a9a3a; }
.ak-result.great { background: rgba(140,100,10,.3); border-color: #ffcf40; box-shadow: 0 0 14px rgba(255,200,60,.35); }
.ak-result.fail { background: rgba(120,30,30,.25); border: 1px solid #9a3a3a; }
.ak-ritual { position: absolute; inset: 40px 0 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: rgba(6,3,2,.86); z-index: 5; }
.ak-rit-chant { font-size: 34px; color: #ffd890; letter-spacing: 6px; text-shadow: 0 0 18px #ff8a3a; animation: akFlick .25s infinite alternate; }
.ak-rit-bar { width: 60%; height: 8px; background: #2a1a10; border-radius: 4px; overflow: hidden; }
.ak-rit-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #a04a1a, #ffd060); animation: akFill 3s linear forwards; }
@keyframes akFill { to { width: 100%; } }
@keyframes akFlick { from { opacity: .75; } to { opacity: 1; } }
#win-akom .win-body { position: relative; }
.inv-cell.ak-great { box-shadow: 0 0 0 1px #ffcf40 inset, 0 0 8px rgba(255,200,60,.4); }
.sk-row.ak-empty { opacity: .5; border-style: dashed; }
@media (max-width: 900px) { .ak-wrap { grid-template-columns: 1fr; } .ak-syl { grid-template-columns: repeat(5, 1fr); } .ak-ess { grid-template-columns: repeat(3, 1fr); } }

.ak-taboos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ak-tb { text-align: left; padding: 6px 8px; background: rgba(0,0,0,.3); border: 1px solid #3a2e1e; color: #f0e0b8; cursor: pointer; border-radius: 6px; }
.ak-tb b { display: block; font-size: 12.5px; }
.ak-tb small { display: block; font-size: 10.5px; color: #a89878; line-height: 1.3; }
.ak-tb.on { border-color: #c04a2a; background: rgba(90,20,10,.45); box-shadow: 0 0 0 1px #c04a2a inset; }
.ak-mini { position: absolute; inset: 40px 0 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(6,3,2,.9); z-index: 6; }
.ak-mini-title { font-family: var(--head); font-size: 22px; color: #ffd890; }
.ak-mini .ak-rit-bar { width: 320px; }
.ak-mini .ak-rit-bar i { animation: none; width: 100%; background: linear-gradient(90deg, #ffd060, #a04a1a); }
.ak-mini-cv { width: 320px; height: 320px; border-radius: 6px; box-shadow: 0 0 24px rgba(255,160,60,.25); touch-action: none; cursor: crosshair; }
.ak-mini-info { color: #e8d8b0; font-size: 14px; }

/* ---------- ตลาดนัด ---------- */
.ak-card.lock { opacity: .35; cursor: not-allowed; }
.ak-media { grid-template-columns: repeat(3, 1fr) !important; }
.mk-filter { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 8px 0; }
.mk-filter .btn.on { border-color: var(--gold); color: var(--gold); }
.mk-search { flex: 1; min-width: 120px; padding: 5px 8px; background: #120c08; border: 1px solid #5a4428; color: #ffe6b0; border-radius: 4px; }
.mk-list { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.mk-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: rgba(0,0,0,.28); border: 1px solid #3a2e1e; border-radius: 6px; }
.mk-row img { width: 36px; height: 36px; }
.mk-info { flex: 1; min-width: 0; }
.mk-name { font-weight: 600; }
.mk-sub { font-size: 11.5px; color: #a89878; }
.btn.dis { opacity: .45; }
.mk-grid { max-height: 240px; overflow-y: auto; margin: 8px 0; }
.inv-cell.sel { box-shadow: 0 0 0 2px var(--gold) inset; }
.mk-sellbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; background: rgba(90,60,20,.25); border: 1px solid #6a4a1a; border-radius: 6px; }
.mk-sellbar img { width: 32px; height: 32px; }
.mk-price, .mk-qty { width: 110px; padding: 5px 7px; background: #120c08; border: 1px solid #5a4428; color: #ffe6b0; border-radius: 4px; }
.mk-qty { width: 60px; }
.mk-collect { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0; padding: 8px; background: rgba(60,120,40,.15); border: 1px solid #4a7a3a; border-radius: 6px; }

/* ปุ่มออโต้ขณะทำงาน: วงแสงหมุน + จุดวิ่ง */
#act-auto { isolation: isolate; }
#act-auto.auto-run::before { content: ''; position: absolute; top: -4px; left: 50%; width: 58px; height: 58px; margin-left: -29px; border-radius: 50%; z-index: -1;
  background: conic-gradient(from 0deg, transparent 0 55%, #ffd060 75%, #fff2b0 85%, transparent 100%); animation: autoSpin 1.1s linear infinite; filter: drop-shadow(0 0 6px #ffb020); }
#act-auto.auto-run img { border-color: #ffd060; animation: autoPulse 1.4s ease-in-out infinite; }
#act-auto.auto-run span { color: #ffd060; }
#act-auto.auto-run span::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: autoDots 1.2s steps(4) infinite; }
@keyframes autoSpin { to { transform: rotate(360deg); } }
@keyframes autoPulse { 0%, 100% { box-shadow: 0 0 8px #ffb020, 0 0 0 1px #000; } 50% { box-shadow: 0 0 20px #ffd060, 0 0 0 1px #000; } }
@keyframes autoDots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
body.mobile #act-auto.auto-run::before { width: 50px; height: 50px; margin-left: -25px; }

/* แนะนำค่าสถานะ */
.st-advice { margin-top: 10px; padding: 8px; background: rgba(0,0,0,.25); border: 1px solid #3a2e1e; border-radius: 8px; }
.st-adv-head { font-family: var(--head); color: var(--gold); font-size: 13px; margin-bottom: 6px; }
.st-adv-card { padding: 6px 8px; margin-top: 6px; border: 1px solid; border-radius: 6px; background: rgba(255,255,255,.02); }
.st-adv-title { font-weight: 700; font-size: 13px; }
.st-adv-title small { font-weight: 400; color: #a89878; }
.st-adv-bars { display: flex; gap: 2px; margin: 5px 0; height: 18px; }
.st-adv-bar { display: flex; align-items: center; justify-content: center; font-size: 10.5px; white-space: nowrap; overflow: hidden; background: linear-gradient(#5a4020, #3a2810); border-radius: 3px; color: #f0e0b8; }
.st-adv-bar:first-child { background: linear-gradient(#8a6020, #5a3a10); }
.st-adv-tip { font-size: 11.5px; color: #b8a888; line-height: 1.4; margin-bottom: 4px; }

.world-canvas { cursor: pointer; }
.world-info { margin-top: 8px; font-size: 13px; line-height: 1.6; padding: 8px; background: rgba(0,0,0,.25); border: 1px solid #3a2e1e; border-radius: 6px; min-height: 44px; }

#clock .ck-dn { font-size: 11px; margin-top: 2px; opacity: .9; }
#clock .ck-dn.night { color: #c8a8ff; }
#clock .ck-dn.day { color: #ffe08a; }
body.mobile #clock .ck-dn { display: none; }

/* ปุ่มรอง: ใช้กรอบลายไทยเดียวกับปุ่มทอง แต่ย้อมเป็นสีรักดำ ให้เข้าชุดกัน */
body.ui-art #screens .btn:not(.gold) { position: relative; isolation: isolate; background: none; }
body.ui-art #screens .btn:not(.gold)::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: var(--ui-btn-gold) center / 100% 100% no-repeat;
  filter: sepia(.6) saturate(.9) hue-rotate(-12deg) brightness(.42) contrast(1.25);
}
body.ui-art #screens .btn:not(.gold):hover::before { filter: sepia(.6) saturate(1) hue-rotate(-12deg) brightness(.55) contrast(1.25); }

/* ================= ตีบวก ================= */
.eq-slot { position: relative; }
.rf-badge { position: absolute; left: 3px; top: 1px; font-style: normal; font-weight: 700; font-size: 12px; font-family: var(--head); text-shadow: 0 0 2px #000, 0 0 3px #000, 0 0 3px #000; pointer-events: none; }
.rf-glow { box-shadow: 0 0 8px rgba(122, 216, 255, .55) inset, 0 0 6px rgba(122, 216, 255, .35); animation: rfPulse 2s ease-in-out infinite; }
@keyframes rfPulse { 50% { box-shadow: 0 0 14px rgba(160, 200, 255, .8) inset, 0 0 10px rgba(160, 200, 255, .5); } }
.tt-refine { color: #8ad8ff; margin-top: 3px; font-size: 12.5px; }
.rf-plus { font-family: var(--head); text-shadow: 0 0 6px currentColor; }
.rf-wrap { display: flex; gap: 12px; min-height: 400px; }
.rf-list { width: 220px; flex: none; max-height: 470px; overflow-y: auto; border: 1px solid #3a2a18; border-radius: 5px; background: rgba(0, 0, 0, .25); padding: 4px; }
.rf-row { display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 4px; cursor: pointer; border: 1px solid transparent; }
.rf-row:hover { background: rgba(232, 196, 106, .08); }
.rf-row.on { background: rgba(232, 196, 106, .16); border-color: var(--gold2); }
.rf-row img { width: 34px; height: 34px; flex: none; }
.rf-row-name { flex: 1; font-size: 13px; line-height: 1.25; }
.rf-worn { font-size: 10.5px; color: #8ad87a; border: 1px solid #4a7a3a; border-radius: 3px; padding: 0 4px; flex: none; }
.rf-main { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rf-anvil { width: 100%; max-height: 150px; object-fit: contain; border-radius: 6px; border: 1px solid #5a4024; background: #120a06; }
.rf-title { font-family: var(--head); font-size: 17px; color: var(--gold); text-align: center; }
.rf-arrow { color: var(--dim); }
.rf-bonus { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; color: var(--dim); }
.rf-bonus b { color: var(--text); font-weight: 500; }
.rf-bonus b.good { color: #8ae07a; }
.rf-chance { font-size: 14px; text-align: center; }
.rf-chance b { font-size: 20px; font-family: var(--head); }
.rf-mats { display: flex; gap: 8px; }
.rf-mat { flex: 1; display: flex; align-items: center; gap: 7px; border: 1px solid #3a2a18; border-radius: 5px; padding: 4px 7px; font-size: 12px; background: rgba(0, 0, 0, .25); }
.rf-mat img { width: 32px; height: 32px; }
.rf-mat b { color: #8ae07a; }
.rf-mat.lack b { color: #ff6a4a; }
.rf-coin { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.rf-coin .coin-ic { width: 32px; height: 32px; margin: 0; }
.coin-ic { width: 1.25em; height: 1.25em; vertical-align: -0.28em; margin-right: 3px; object-fit: contain; }
.rf-opts { display: flex; flex-direction: column; gap: 3px; }
.rf-opts.off { opacity: .45; }
.rf-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; }
.rf-check.dis { cursor: default; color: var(--dim); }
.rf-check img { width: 24px; height: 24px; }
.rf-warn { color: #ff7a5a; font-size: 12.5px; text-align: center; background: rgba(160, 30, 10, .18); border: 1px solid rgba(255, 90, 60, .35); border-radius: 4px; padding: 4px; }
.rf-warn.soft { color: #e8c46a; background: rgba(160, 120, 10, .12); border-color: rgba(232, 196, 106, .3); }
.rf-go { align-self: center; min-width: 180px; font-size: 16px !important; }
.rf-go[disabled] { filter: grayscale(.8) brightness(.7); cursor: default; }
.rf-res { text-align: center; font-family: var(--head); font-size: 17px; padding: 4px; border-radius: 4px; animation: rfIn .4s ease-out; }
.rf-res-ok { color: #ffe48a; text-shadow: 0 0 10px rgba(255, 220, 120, .8); }
.rf-res-down { color: #d8b080; }
.rf-res-broke { color: #ff6a4a; animation: rfShake .5s; }
@keyframes rfIn { from { transform: scale(1.4); opacity: 0; } }
@keyframes rfShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ================= ตั้งค่าเสียง ================= */
.snd { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #3a2a18; }
.snd h4 { margin: 0 0 6px; color: var(--gold); font-family: var(--head); font-weight: 500; }
.snd-row { display: grid; grid-template-columns: 96px 52px 1fr 42px; align-items: center; gap: 8px; margin: 6px 0; font-size: 13.5px; }
.snd-row.off .snd-range, .snd-row.off .snd-pct { opacity: .4; }
.snd-pct { text-align: right; font-weight: 500; color: var(--text); }
.snd-range { width: 100%; accent-color: var(--gold); cursor: pointer; }
.snd-toggle { border: 1px solid #5a4024; background: #1a120a; color: var(--dim); border-radius: 12px; padding: 2px 0; font-size: 12px; cursor: pointer; font-family: var(--font); }
.snd-toggle.on { background: linear-gradient(180deg, #6a8a2a, #3a5a14); color: #f0ffd8; border-color: #8ab04a; }
.snd-quick { display: flex; gap: 8px; margin-top: 8px; }
.snd-quick .btn { flex: 1; }
.rf-safe { color: #8ae07a; font-size: 12.5px; text-align: center; }

/* ================= การ์ด ================= */
.c-pips { position: absolute; left: 0; right: 0; bottom: 2px; display: flex; justify-content: center; gap: 2px; pointer-events: none; }
.c-pips i { width: 6px; height: 6px; transform: rotate(45deg); border: 1px solid #c8a050; background: rgba(0, 0, 0, .6); }
.c-pips i.on { background: #ffd040; box-shadow: 0 0 4px #ffd040; border-color: #fff0b0; }
.tt-slots { color: #c8b890; font-size: 12px; }
.tt-cards { margin-top: 4px; border-top: 1px dashed #5a4024; padding-top: 3px; font-size: 12.5px; }
.tt-cslot { color: #8a7a5a; }
.tt-cslot.on { color: #ffd870; }
.tt-cslot.on span { color: #e8dcc0; }
.tt-card { color: #ffd870; }
.ci-top { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; }
.ci-card { width: 150px; height: 200px; flex: none; filter: drop-shadow(0 4px 10px #000); }
.ci-info { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.ci-name { font-family: var(--head); font-size: 18px; }
.ci-stats { color: #ffd870; font-size: 14px; line-height: 1.5; }
.ci-list { max-height: 220px; overflow-y: auto; border: 1px solid #3a2a18; border-radius: 5px; background: rgba(0, 0, 0, .25); padding: 4px; }
.ci-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 4px; cursor: pointer; border: 1px solid transparent; position: relative; }
.ci-row:hover { background: rgba(232, 196, 106, .08); }
.ci-row.on { background: rgba(232, 196, 106, .16); border-color: var(--gold2); }
.ci-row.full { opacity: .5; cursor: default; }
.ci-row img { width: 34px; height: 34px; }
.ci-row-name { flex: 1; font-size: 13px; }
.ci-row .c-pips { position: static; }
.ci-confirm { margin-top: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }

/* ================= ต้นวิชาแบบ RO (แต้มวิชา) ================= */
.sk-points { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 14px; margin-bottom: 8px; padding: 6px 10px; border: 1px solid #5a4024; border-radius: 6px; background: linear-gradient(180deg, rgba(60, 40, 16, .6), rgba(20, 12, 6, .6)); }
.sk-pt-main { font-family: var(--head); font-size: 16px; color: var(--text); }
.sk-pt-main b { font-size: 24px; color: var(--dim); margin: 0 2px; }
.sk-pt-main b.has { color: #ffe060; text-shadow: 0 0 10px rgba(255, 220, 90, .6); }
.sk-pt-pend { font-size: 13px; color: #8ae07a; }
.sk-pt-sub { font-size: 11.5px; }
.sk-pt-btns { display: flex; gap: 6px; }
.skb-scroll { flex: 1; max-height: 560px; overflow: auto; background: radial-gradient(ellipse at top, rgba(60, 40, 18, .5), rgba(10, 6, 3, .6)); border: 1px solid #3a2a18; border-radius: 6px; padding: 8px; }
.skb-wrap { display: grid; gap: 10px; }
.skb-wrap.other { filter: grayscale(.6) brightness(.75); }
.skb-col { display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.skb-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 8px; border-radius: 6px; background: linear-gradient(180deg, #4a2e14, #24160a); border: 1px solid #8a6a38; box-shadow: inset 0 1px 0 rgba(255, 220, 150, .2); position: sticky; top: -8px; z-index: 2; }
.skb-icon { font-size: 22px; width: 32px; text-align: center; flex: none; }
.skb-name { font-family: var(--head); font-size: 15px; color: var(--gold); }
.skb-desc { font-size: 11px; color: var(--dim); line-height: 1.25; }
.skb-spent { margin-left: auto; font-size: 12px; color: var(--dim); flex: none; }
.skb-spent b { color: #ffe060; font-size: 15px; }
.skb-link { width: 3px; height: 12px; margin: 0 auto; background: #3a2a18; }
.skb-link.open { background: #8a6a38; }
.skb-link.on { background: linear-gradient(#ffd060, #c89030); box-shadow: 0 0 6px rgba(255, 200, 80, .6); }
.skb-node { display: flex; align-items: center; gap: 7px; padding: 5px 6px; border-radius: 7px; border: 1px solid #3a2a18; background: rgba(14, 8, 4, .85); cursor: pointer; position: relative; }
.skb-node:hover { border-color: #8a6a38; }
.skb-node.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.skb-node.locked { opacity: .5; }
.skb-node.ready { border-color: #6a8a3a; animation: skbReady 2s ease-in-out infinite; }
@keyframes skbReady { 50% { box-shadow: 0 0 10px rgba(140, 220, 90, .35); } }
.skb-node.learned { border-color: #4a8a5a; background: linear-gradient(90deg, rgba(30, 60, 30, .45), rgba(14, 8, 4, .85)); }
.skb-node.max { border-color: #d8a030; background: linear-gradient(90deg, rgba(90, 60, 10, .55), rgba(14, 8, 4, .85)); }
.skb-img { position: relative; flex: none; }
.skb-img img { width: 44px; height: 44px; border-radius: 6px; display: block; }
.skb-node.locked .skb-img img { filter: grayscale(1); }
.skb-img .sk-lock { position: absolute; right: -3px; bottom: -3px; top: auto; left: auto; font-size: 13px; }
.skb-info { flex: 1; min-width: 0; }
.skb-sname { font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skb-lv { font-size: 11.5px; color: var(--text); }
.skb-pips { display: flex; gap: 2px; margin-top: 2px; }
.skb-pips i { flex: 1; max-width: 12px; height: 5px; border-radius: 2px; background: #2a1e12; border: 1px solid #4a3620; }
.skb-pips i.on { background: #ffd060; border-color: #ffe9a0; }
.skb-pips i.pend { background: #7ad85a; border-color: #b0f090; }
.skb-btns { display: flex; flex-direction: column; gap: 3px; flex: none; }
.skb-plus, .skb-minus { width: 24px; height: 22px; border-radius: 5px; border: 1px solid #8a6a38; background: linear-gradient(180deg, #6a8a2a, #3a5a14); color: #f0ffd8; font-weight: 700; font-size: 15px; line-height: 1; cursor: pointer; padding: 0; }
.skb-minus { background: linear-gradient(180deg, #8a3a2a, #5a1a10); }
.skb-plus[disabled], .skb-minus[disabled] { background: #2a1e12; color: #5a4a30; border-color: #3a2a18; cursor: default; }
.skb-innate { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12.5px; }
.skb-inn { display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border: 1px solid #5a4024; border-radius: 6px; cursor: pointer; background: rgba(14, 8, 4, .8); }
.skb-inn.sel { border-color: var(--gold); }
.skb-inn img { width: 32px; height: 32px; border-radius: 5px; }
.sk-next { display: grid; grid-template-columns: 1fr auto auto auto; gap: 2px 6px; font-size: 12px; }
.sk-next span { color: var(--dim); }
.sk-next i { color: var(--dim); font-style: normal; }
.sk-next b.good { color: #8ae07a; }
.tt-sklv { color: #ffe060; font-size: 12.5px; margin: 2px 0; }
.ak-special { border: 1px solid #d8a030 !important; background: linear-gradient(90deg, rgba(110, 70, 10, .45), rgba(20, 12, 4, .8)) !important; box-shadow: 0 0 10px rgba(255, 200, 80, .15); }
.rw-sp { color: #ffe060; font-weight: 600; }

/* ================= ตัวแต่งรูปลักษณ์ (สร้างตัวละคร / ร้านแต่งตัว) ================= */
#screens .create-box.create-wide { width: min(1080px, 96vw); max-width: none; }
.le { display: flex; gap: 16px; align-items: flex-start; }
.le-left { width: 300px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.le-cv { width: 300px; height: 380px; border-radius: 10px; background: radial-gradient(ellipse at 50% 70%, rgba(80, 50, 20, .55), rgba(10, 6, 3, .35)); border: 1px solid rgba(138, 106, 56, .5); }
.le-acts, .le-ctl { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.le-wpns { margin-top: 4px; } .le-wpns .le-chip { font-size: 12px; padding: 2px 9px; }
.le-chip { border: 1px solid #6a5030; background: rgba(20, 12, 6, .85); color: #e8d8b8; border-radius: 14px; padding: 3px 11px; font-size: 13px; cursor: pointer; font-family: var(--font); }
.le-chip:hover { border-color: var(--gold2); }
.le-chip.on { background: linear-gradient(180deg, #8a6a28, #5a4014); color: #fff6d8; border-color: var(--gold); }
.le-dir { min-width: 64px; text-align: center; font-size: 13px; color: var(--gold); align-self: center; }
.le-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.le-cats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.le-cat { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px; border-radius: 8px; border: 1px solid #5a4024; background: rgba(16, 10, 5, .85); color: #e8d8b8; cursor: pointer; font-family: var(--font); min-width: 0; }
.le-cat:hover { border-color: var(--gold2); }
.le-cat.on { border-color: var(--gold); background: linear-gradient(180deg, rgba(110, 80, 30, .7), rgba(30, 18, 8, .9)); box-shadow: 0 0 10px rgba(232, 196, 106, .25); }
.le-cat-ic { font-size: 20px; line-height: 1.1; }
.le-cat-n { font-size: 12.5px; color: var(--gold); font-family: var(--head); }
.le-cat-v { font-size: 11px; color: var(--dim); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.le-sw { display: inline-block; width: 22px; height: 12px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, .5); }
.le-opts { background: rgba(10, 6, 3, .6); border: 1px solid #3a2a18; border-radius: 8px; padding: 10px; max-height: 360px; overflow-y: auto; }
.le-hint { font-size: 12px; color: var(--dim); margin-bottom: 8px; }
.le-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.le-grid-sm { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); margin-top: 10px; }
.le-grid-id { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.le-tile { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; border-radius: 8px; border: 1px solid #4a3620; background: rgba(24, 14, 7, .9); color: #e8d8b8; cursor: pointer; font-family: var(--font); font-size: 12.5px; transition: transform .08s; }
.le-tile:hover { border-color: var(--gold2); transform: translateY(-1px); }
.le-tile.on { border-color: var(--gold); background: linear-gradient(180deg, rgba(120, 88, 30, .55), rgba(24, 14, 7, .95)); box-shadow: 0 0 0 1px var(--gold) inset, 0 0 12px rgba(232, 196, 106, .3); }
.le-tile canvas { background: radial-gradient(circle at 50% 45%, rgba(90, 60, 30, .6), rgba(10, 6, 3, .2)); border-radius: 6px; }
.le-tile small { font-size: 11px; color: var(--dim); line-height: 1.25; text-align: center; }
.le-grid-id .le-tile { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; text-align: left; padding: 8px 10px; column-gap: 8px; }
.le-grid-id .le-tile small { text-align: left; width: 100%; }
.le-id-ic { font-size: 24px; }
.le-colors { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.le-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); cursor: pointer; padding: 0; }
.le-color.on { border-color: #fff; box-shadow: 0 0 0 2px var(--gold), 0 0 10px rgba(255, 220, 120, .6); }
.le-color.orig { width: auto; border-radius: 15px; padding: 0 10px; background: #2a1e12; color: #e8d8b8; font-size: 12px; font-family: var(--font); }
.le-custom { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--dim); margin-left: 6px; cursor: pointer; }
.le-picker { width: 38px; height: 30px; border: none; background: none; padding: 0; cursor: pointer; }
.create-bottom { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; margin-top: 10px; }
.create-bottom .cname { display: flex; align-items: center; gap: 10px; }
.create-bottom .cname span { color: var(--gold); white-space: nowrap; }
.create-bottom .cname input { flex: 1; }
.create-bottom .err { grid-column: 1 / -1; }
.create-bottom p { grid-column: 1; margin: 0; }
.create-bottom .row { grid-column: 2; grid-row: 1 / span 3; display: flex; flex-direction: column; gap: 8px; }
.salon-bar { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 10px; }
.char-idn { font-size: 13px; }
@media (max-width: 760px) { .le { flex-direction: column; align-items: center; } .le-cats { grid-template-columns: repeat(3, 1fr); } .create-bottom { grid-template-columns: 1fr; } .create-bottom .row { grid-column: 1; grid-row: auto; flex-direction: row; } }

/* หัวกิ่งต้นวิชาสูงเท่ากัน */
.skb-head { min-height: 64px; box-sizing: border-box; }
.skb-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }

/* HUD บนขวา: แผนที่ติดขอบบน · นาฬิกาอยู่ซ้ายแผนที่ · เมนูขยับไปทางซ้าย */
#minimap { top: 0; right: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
#clock { top: 10px; right: 312px; flex-direction: column; align-items: flex-end; gap: 2px; }
#topMenu { right: 470px; top: 6px; }
@media (max-width: 1100px) { #topMenu { right: 312px; top: 64px; } }
body.mobile #clock { right: 16px; flex-direction: row; }

/* ================= ภาพ UI ในเกม (เฟส 7) — เปิดเฉพาะชิ้นที่มีภาพ ================= */
body.has-win-frame .win { border: 22px solid transparent; border-image: var(--ui-win) 44 fill / 22px stretch; background: none; border-radius: 0; box-shadow: 0 14px 40px rgba(0,0,0,.65); }
body.has-win-frame .win-head { margin: -14px -12px 6px; border-radius: 0; }
body.has-win-head .win-head { background: var(--ui-win-head) center / 100% 100% no-repeat; border: 0; min-height: 30px; }
body.has-tab .tabs button { background: var(--ui-tab) center / 100% 100% no-repeat; border: 0; border-radius: 0; padding: 7px 16px; }
body.has-tab-on .tabs button.on { background-image: var(--ui-tab-on); color: #fff3c8; }
body.has-close .win-x { background: var(--ui-close) center / contain no-repeat; color: transparent; width: 28px; height: 28px; }
body.has-slot .hb-slot, body.has-slot .hb-weapon, body.has-slot .hb-bag, body.has-slot .eq-slot, body.has-slot .inv-cell { background: var(--ui-hslot) center / 100% 100% no-repeat; border-color: transparent; }
body.has-btn-round .act-btn { background: var(--ui-round) center / 100% 100% no-repeat; border: 0; }
body.has-bar-frame #playerFrame .bar { border-image: var(--ui-bar) 12 fill / 6px stretch; border-style: solid; }
body.has-minimap-frame #minimap { border: 18px solid transparent; border-image: var(--ui-mm) 36 fill / 18px stretch; background: none; }
body.has-profile-ring #playerFrame .pf-portrait { background: var(--ui-ring2) center / 100% 100% no-repeat; }
body.has-joystick-base .joy-ring { background: var(--ui-joy) center / 100% 100% no-repeat; border: 0; }
body.has-joystick-knob .joy-knob { background: var(--ui-knob) center / 100% 100% no-repeat; border: 0; }
body.has-attack-btn #mAtk { background: var(--ui-atk) center / 100% 100% no-repeat; border: 0; }

/* ซูมแผนที่ใหญ่ */
.map-wrap { position: relative; }
.map-wrap canvas { touch-action: none; cursor: crosshair; }
.map-zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.map-zbtn { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--gold2); background: rgba(20,12,6,.88); color: var(--gold); font-size: 18px; line-height: 1; cursor: pointer; font-family: var(--font); }
.map-zbtn:hover { background: rgba(60,40,16,.95); color: #fff6d8; }
.map-zlv { font-size: 11px; color: var(--dim); text-shadow: 0 1px 2px #000; }

.lan-box { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #3a2a18; display: flex; flex-direction: column; gap: 5px; }
.lan-box h4 { margin: 0; color: var(--gold); font-family: var(--head); font-weight: 500; }
.lan-url { display: flex; align-items: center; gap: 8px; }
.lan-url code { flex: 1; background: #0e0804; border: 1px solid #5a4024; border-radius: 4px; padding: 4px 8px; color: #ffe8a0; font-size: 14px; user-select: all; }

/* ===== ปาร์ตี้ / แลกเปลี่ยน ===== */
.btn.xs { padding: 1px 7px; font-size: 11.5px; line-height: 1.4; }
.ctx-title { padding: 6px 12px 4px; font-size: 12px; color: var(--gold); border-bottom: 1px solid #3a2410; }
.ctx-menu button[disabled] { opacity: 0.4; cursor: default; }
.ask-pop { position: fixed; z-index: 300; top: 92px; left: 50%; transform: translateX(-50%); min-width: 300px; background: linear-gradient(#2a1a0e, #170e07); border: 1px solid var(--gold2); border-radius: 8px; box-shadow: 0 10px 30px #000; padding: 12px 16px 8px; text-align: center; }
.ask-text { font-family: var(--head); font-size: 15px; color: var(--text); margin-bottom: 10px; }
.ask-btns { display: flex; gap: 10px; justify-content: center; }
.ask-bar { height: 3px; margin-top: 10px; background: #2a1a0e; border-radius: 2px; overflow: hidden; }
.ask-bar i { display: block; height: 100%; width: 100%; background: var(--gold); }
.pt-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding-right: 22px; }
.pt-row.me b::after { content: ' (คุณ)'; color: #9a8a6a; font-weight: 400; font-size: 11px; }
.pt-row.dead { opacity: 0.5; }
.pt-crown { font-size: 12px; }
.pt-map { color: #9a8a6a; font-size: 11px; }
.pt-kick { position: absolute; right: 2px; top: 2px; }
.pt-share { display: flex; align-items: center; gap: 4px; margin: 8px 0 4px; font-size: 12px; }
.pt-note { font-size: 11px; color: #e0a060; margin-bottom: 4px; }
.pt-leave { margin-top: 4px; }
.tr-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tr-side { border: 1px solid #4a3418; border-radius: 6px; padding: 8px; background: rgba(0,0,0,.25); }
.tr-side.locked { border-color: #c8a040; }
.tr-side.ok { border-color: #5ad85a; box-shadow: 0 0 10px rgba(90,216,90,.3) inset; }
.tr-name { font-family: var(--head); margin-bottom: 6px; }
.tr-grid { display: grid; grid-template-columns: repeat(4, 56px); gap: 4px; }
.tr-goldrow { margin-top: 8px; font-size: 13px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tr-gold { width: 110px; }
.tr-tax { color: #e0a060; font-size: 11.5px; }
.tr-sub { margin: 10px 0 4px; font-size: 12px; color: #b8a888; }
.tr-bag { display: grid; grid-template-columns: repeat(auto-fill, 56px); gap: 4px; max-height: 172px; overflow-y: auto; }
.tr-bag .inv-cell { cursor: pointer; }
.inv-cell.no-trade { opacity: 0.35; cursor: not-allowed; filter: grayscale(.8); }
.tr-btns { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.tr-note { margin-top: 8px; font-size: 11px; color: #8a7a5a; text-align: center; }
#chatLog .cl-party, #chatLog .cl-party .tag { color: #8affc0; }
/* สถานะบอสในสมุดภาพ */
.md-bossinfo { margin-top: 8px; padding: 8px 10px; border: 1px solid #6a2a1a; border-radius: 6px; background: rgba(60, 12, 8, .35); font-size: 13px; line-height: 1.6; }
.md-boss-on { color: #8aff8a; font-weight: 600; }
.md-boss-off { color: #ffcf6a; font-weight: 600; }
.md-boss-kill { color: #e8d8c0; }
.md-boss-skill { color: #c8b8a8; font-size: 12px; }
/* กระเป๋าชั่วคราว */
.ov-head { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 6px 8px; border: 1px dashed #8a6a3a; border-radius: 6px; background: rgba(60, 40, 10, .35); font-size: 13px; }
.ov-head small { flex: 1; color: #c8b090; }
.ov-head.full { border-color: #d83a2a; background: rgba(90, 16, 10, .45); }
.ov-head.full span { color: #ff7a5a; }
.ov-grid { margin-top: 6px; }
.ov-cell { background: rgba(60, 40, 10, .3); }
/* Phase 14: manifest-backed artwork; these rules activate only after image load. */
#deviceToggle .dt-ico img { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; }
#mTgt > img, #mChatBtn > img, #mPotCfg > img { width: 80%; height: 80%; object-fit: contain; pointer-events: none; }
body .joy-ring.has-icon-art, body .joy-knob.has-icon-art { background-color: transparent; background-size: 100% 100%; background-repeat: no-repeat; border-color: transparent; box-shadow: none; }
.joy-ring.has-icon-art ~ .joy-arrow { display: none; }
body.has-p14-round .act-btn > img,
body.has-p14-round .m-skill,
body.has-p14-round #mAtk { background-image: var(--ui-p14-round); background-size: 100% 100%; background-repeat: no-repeat; background-position: center; border-color: transparent; }
body.has-p14-round.has-btn-round .act-btn { background: transparent; }
body.has-p14-round #mSkills .m-skill { padding: 7px; }
body.has-p14-round .m-skill > img { border-radius: 50%; }
body.has-p14-round .m-skill.empty > img { visibility: hidden; }
body.has-p14-round .act-btn:hover > img,
body.has-p14-round .act-btn:active > img,
body.has-p14-round .m-skill:hover,
body.has-p14-round .m-skill:active,
body.has-p14-round .m-atk:hover,
body.has-p14-round .m-atk:active { box-shadow: 0 0 12px rgba(255, 202, 96, .6); }

/* ===== อีเวนต์สนามประลอง: อาจารย์ถ่ายทอดอาคม ===== */
.buff.gift { border-color: #ffd040; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle, #5a3a08, #1a0f02); box-shadow: 0 0 6px rgba(255, 208, 64, .6); }
.buff.gift b { font-size: 14px; line-height: 1; margin-top: -4px; }
#aev { position: fixed; top: 96px; left: 50%; transform: translateX(-50%); z-index: 60; width: min(560px, calc(100vw - 32px)); padding: 14px 18px 12px; border-radius: 10px;
  background: linear-gradient(180deg, rgba(40, 18, 6, .94), rgba(16, 8, 3, .94)); border: 1px solid #c8963a; box-shadow: 0 0 0 1px #000, 0 0 28px rgba(255, 170, 60, .35), 0 8px 30px rgba(0, 0, 0, .6);
  text-align: center; color: var(--text); animation: aevIn .45s ease-out; }
#aev[hidden] { display: none; }
.aev-head { display: flex; align-items: center; gap: 12px; text-align: left; }
.aev-face { width: 50px; height: 50px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 30px;
  background: radial-gradient(circle at 40% 35%, #8a5a20, #2a1404); border: 2px solid #ffd27a; box-shadow: 0 0 14px rgba(255, 200, 90, .7); animation: aevGlow 1.6s ease-in-out infinite; }
.aev-name { font-family: var(--head); font-size: 18px; color: #ffd27a; text-shadow: 0 0 8px rgba(255, 190, 80, .6); }
.aev-sub { font-size: 13px; color: #e8d8b8; opacity: .9; }
.aev-count { font-family: var(--head); font-size: 64px; line-height: 1.1; margin-top: 4px; color: #ffe48a; text-shadow: 0 0 18px rgba(255, 200, 80, .9), 0 2px 0 #5a2a00; }
.aev-count.pop { animation: aevPop .5s ease-out; }
.aev-words { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; margin: 12px 0 6px; min-height: 44px; }
.aev-word { font-family: var(--head); font-size: 28px; color: #ffe9a8; text-shadow: 0 0 12px rgba(255, 190, 60, .9); animation: aevWord .6s ease-out; }
.aev-words.done .aev-word { font-size: 22px; animation: none; }
.aev-input { width: 100%; box-sizing: border-box; font-size: 20px; padding: 8px 12px; text-align: center; border-radius: 6px; border: 1px solid #c8963a; background: rgba(0, 0, 0, .55); color: #fff; outline: none; }
.aev-input:focus { box-shadow: 0 0 10px rgba(255, 200, 90, .55); }
.aev-input.shake { animation: rfShake .4s; border-color: #ff6a4a; }
.aev-tip { font-size: 12px; color: var(--dim); margin-top: 4px; }
.aev-bar { height: 6px; margin-top: 10px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.aev-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff6a3a, #ffd040); transition: width .1s linear; }
.aev-win { margin-top: 8px; font-size: 15px; }
.aev-win.me b { color: #ffe48a; }
.aev-gift { font-family: var(--head); font-size: 18px; color: #ffd040; text-shadow: 0 0 10px rgba(255, 200, 60, .8); }
@keyframes aevIn { from { opacity: 0; transform: translate(-50%, -14px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes aevPop { from { transform: scale(1.6); opacity: .3; } to { transform: scale(1); opacity: 1; } }
@keyframes aevWord { from { transform: translateY(8px) scale(1.4); opacity: 0; filter: blur(3px); } to { transform: none; opacity: 1; filter: none; } }
@keyframes aevGlow { 50% { box-shadow: 0 0 24px rgba(255, 210, 110, 1); } }
@media (max-width: 600px) { #aev { top: 70px; } .aev-count { font-size: 48px; } .aev-word { font-size: 22px; } }

/* ===== หน้าตีบวก (ปรับใหม่) ===== */
.rf-group { font-size: 11px; color: var(--gold2); letter-spacing: .5px; padding: 6px 6px 2px; border-bottom: 1px solid rgba(232, 196, 106, .18); margin-bottom: 3px; }
.rf-risk { color: #ff8a5a; font-size: 13px; flex: none; }
.rf-anvil { max-height: 170px; }
.rf-track { display: flex; gap: 3px; justify-content: center; }
.rf-track i { flex: 1; max-width: 34px; height: 20px; border-radius: 3px; font-style: normal; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .4); border: 1px solid #3a2a18; color: #6a5a48; }
.rf-track i.safe { border-color: rgba(122, 224, 122, .35); }
.rf-track i.risk { border-color: rgba(255, 106, 74, .4); }
.rf-track i.on { color: #1a1008; background: linear-gradient(180deg, #ffe48a, #c8962a); border-color: #ffe48a; }
.rf-track i.on[style] { background: var(--g); border-color: var(--g); box-shadow: 0 0 6px var(--g); }
.rf-track i.next { animation: rfNext 1s ease-in-out infinite; color: #ffe48a; }
.rf-track i.next.risk { color: #ff8a5a; }
@keyframes rfNext { 50% { box-shadow: 0 0 8px rgba(255, 220, 120, .8); background: rgba(255, 220, 120, .15); } }
.rf-chance { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.rf-chance span { color: var(--dim); flex: none; }
.rf-cbar { flex: 1; height: 10px; border-radius: 5px; background: rgba(0, 0, 0, .5); border: 1px solid #3a2a18; overflow: hidden; }
.rf-cbar i { display: block; height: 100%; border-radius: 5px; transition: width .3s; }
.rf-chance b { font-size: 20px; font-family: var(--head); min-width: 52px; text-align: right; }
.rf-fail { font-size: 12.5px; text-align: center; color: var(--dim); }
.rf-maxed { text-align: center; padding: 14px 8px; border-radius: 6px; border: 1px solid rgba(255, 208, 64, .5); background: radial-gradient(ellipse at center, rgba(255, 200, 60, .16), rgba(0, 0, 0, .2)); display: flex; flex-direction: column; gap: 4px; }
.rf-maxed b { font-family: var(--head); font-size: 20px; color: #ffd040; text-shadow: 0 0 12px rgba(255, 200, 60, .8); }
.rf-maxed span { font-size: 12.5px; color: var(--dim); }
.aev-face img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.aev-gift img { width: 28px; height: 28px; vertical-align: middle; }

/* ===== สมุดภาพ: ไอเท็มทั้งหมด + หน้ารายละเอียดไอเท็ม ===== */
.cx-filter { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 4px; }
.cx-filter .btn.on { border-color: var(--gold2); color: var(--gold); background: rgba(232, 196, 106, .16); }
.cx-search { flex: 1; min-width: 140px; padding: 4px 8px; border-radius: 4px; border: 1px solid #5a4024; background: rgba(0, 0, 0, .45); color: var(--text); }
.cx-cell.it, .md-drop.link, .id-src.link, .id-chips .link { cursor: pointer; }
.md-drop.link:hover, .id-src.link:hover { background: rgba(232, 196, 106, .1); }
.id-body { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 8px; }
.id-left { width: 210px; flex: none; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.id-big { width: 200px; height: 200px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--rc) 28%, transparent), rgba(0, 0, 0, .55) 70%); border: 2px solid var(--rc); box-shadow: 0 0 18px color-mix(in srgb, var(--rc) 40%, transparent) inset; }
.id-big img { width: 176px; height: 176px; object-fit: contain; image-rendering: auto; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .7)); }
.id-right { flex: 1; min-width: 0; }
.id-tip { background: rgba(0, 0, 0, .3); border: 1px solid #3a2a18; border-radius: 6px; padding: 8px 10px; font-size: 13px; line-height: 1.5; }
.id-srcs { display: flex; flex-direction: column; gap: 4px; }
.id-src { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border: 1px solid #3a2a18; border-radius: 5px; background: rgba(0, 0, 0, .25); }
.id-src.col { flex-direction: column; align-items: stretch; }
.id-src-row { display: flex; align-items: center; gap: 10px; }
.id-src canvas { flex: none; }
.id-src-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.id-src-main b { font-weight: 600; }
.id-src-main small { color: var(--dim); font-size: 12px; }
.id-ico { width: 44px; text-align: center; font-size: 24px; flex: none; }
.id-ico-img { width: 40px; height: 40px; flex: none; margin: 0 2px; }
.id-pct { font-family: var(--head); color: #8ae07a; font-size: 15px; flex: none; }
.id-chips { display: flex; flex-wrap: wrap; gap: 4px; padding-left: 54px; }
.id-chips span { font-size: 12px; padding: 1px 7px; border-radius: 10px; border: 1px solid #5a4024; background: rgba(0, 0, 0, .3); }
.id-chips .link:hover { border-color: var(--gold2); color: var(--gold); }
@media (max-width: 640px) { .id-body { flex-direction: column; align-items: center; } }
.cx-cell.it:hover { border-color: var(--gold2); background: #1e140a; }

/* ตัวอย่างวิชาในหน้าต้นวิชา */
.sk-prev-box { position: relative; margin-bottom: 8px; border: 1px solid #5a4024; border-radius: 6px; overflow: hidden; background: #140d07; }
.sk-prev { display: block; width: 100%; height: auto; }
.sk-prev-cap { position: absolute; left: 6px; top: 4px; font-size: 11px; color: var(--gold); text-shadow: 0 1px 2px #000; opacity: .8; }
.st-wrap { display: flex; gap: 14px; justify-content: center; }
.st-col { flex: 1; min-width: 0; }
.st-head { font-family: var(--head); color: var(--gold); text-align: center; margin-bottom: 6px; }
.st-grid { max-height: 360px; }
@media (max-width: 760px) { .st-wrap { flex-direction: column; } }
.st-cell.st-new { border: 2px solid #5ad85a !important; box-shadow: 0 0 8px rgba(90,216,90,.45); }
.st-cell.st-out { border: 2px solid #ff9a3a !important; box-shadow: 0 0 8px rgba(255,154,58,.45); }
.st-tag { position: absolute; left: 2px; top: 1px; font-style: normal; font-size: 10px; padding: 0 4px; border-radius: 6px; background: rgba(0,0,0,.7); color: #fff; }
.st-new .st-tag { color: #8affa0; } .st-out .st-tag { color: #ffc080; }
.st-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 10px; border-radius: 6px; background: rgba(0,0,0,.25); border: 1px solid #3a2e1e; font-size: 13px; }
.st-bar.on { border-color: var(--gold2); background: rgba(90,60,20,.3); }
.st-btns { display: flex; gap: 6px; }
.qty-modal { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); }
.qty-box { padding: 14px 16px; min-width: 300px; display: flex; flex-direction: column; gap: 10px; }
.qty-row { display: flex; align-items: center; gap: 8px; } .qty-rng { flex: 1; } .qty-inp { width: 70px; }
.qty-btns { display: flex; justify-content: flex-end; gap: 6px; }
.reg-box { width: min(520px, 100%); }
.reg-box h3 { margin: 0 0 12px; text-align: center; font-family: var(--head); color: var(--gold); }
.reg-chk { display: block; min-height: 15px; font-size: 11.5px; margin-top: 2px; }
.reg-chk.bad { color: #ff8a7a; } .reg-chk.good { color: #7affb0; }
.reg-terms-head { font-size: 13px; color: var(--gold); margin: 4px 0 6px; }
.reg-terms { max-height: 190px; overflow-y: auto; padding: 8px 12px; background: rgba(0,0,0,.35); border: 1px solid #5a4024; border-radius: 6px; font-size: 12.5px; line-height: 1.6; color: #e0d2b8; }
.reg-terms h4 { margin: 6px 0 4px; color: #ffd86a; font-size: 13px; }
.reg-terms ol { margin: 0 0 6px; padding-left: 20px; }
.reg-end { text-align: center; color: var(--dim); margin: 6px 0 0; }
.login-box .reg-agree { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 4px; color: var(--text); font-size: 13px; cursor: pointer; }
.login-box .reg-agree input { width: auto; display: inline-block; margin-top: 3px; }
.reg-agree.dis { opacity: .55; cursor: not-allowed; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.donate-btn .donate-ico { font-style: normal; font-size: 22px; line-height: 28px; color: #ff6a7a; text-shadow: 0 0 8px rgba(255,80,100,.6); display: block; }
.don { font-size: 13.5px; line-height: 1.6; }
.don-lead { margin: 0 0 10px; }
.don-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 8px 0 12px; }
.don-qr img { width: min(260px, 80%); border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.5); background: #fff; }
.don-acc { display: flex; flex-direction: column; align-items: center; }
.don h4 { margin: 12px 0 6px; color: var(--gold); font-family: var(--head); }
.don-steps { margin: 0; padding-left: 20px; }
.don-tiers { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.don-tier { flex: 1; min-width: 140px; display: flex; flex-direction: column; align-items: center; padding: 8px; border: 1px solid #5a4024; border-radius: 8px; background: rgba(0,0,0,.25); }
.don-badge { font-size: 22px; }
.don-mine { margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: rgba(255,210,100,.15); border: 1px solid var(--gold2); color: #ffe9a0; text-align: center; }
.don-note { font-size: 12px; margin: 10px 0 0; }
.don-list { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.don-name { font-weight: 600; }
.don-msgbox { display: flex; flex-direction: column; gap: 4px; }
.don-msg { width: 100%; resize: vertical; padding: 8px 10px; background: #120a06; border: 1px solid #5a4024; color: var(--text); border-radius: 6px; font-family: var(--font); font-size: 13.5px; }
.don-msgrow { display: flex; justify-content: space-between; align-items: center; }
.don-list { flex-direction: column; gap: 4px; }
.don-row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.don-quote { font-style: italic; color: #e0d2b8; font-size: 12.5px; }
.sup-banner { position: fixed; top: 92px; left: 50%; transform: translateX(-50%); z-index: 8000; min-width: min(460px, 92vw); max-width: 92vw; text-align: center; padding: 12px 22px 14px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(60,30,8,.96), rgba(28,14,4,.96)); border: 2px solid #e8b84a; box-shadow: 0 0 30px rgba(255,190,80,.45), 0 8px 24px rgba(0,0,0,.6);
  animation: supIn .5s cubic-bezier(.2,1.4,.4,1); pointer-events: none; }
.sup-banner.t3 { border-color: #ffcf40; box-shadow: 0 0 46px rgba(255,207,64,.7), 0 8px 24px rgba(0,0,0,.6); }
.sup-banner.out { opacity: 0; transform: translate(-50%, -14px); transition: all .7s ease; }
.sup-b-top { font-size: 13px; color: #ffd86a; letter-spacing: .5px; }
.sup-b-name { font-family: var(--head); font-size: 26px; text-shadow: 0 2px 6px #000, 0 0 12px rgba(255,200,80,.5); margin: 2px 0; }
.sup-b-tier { font-size: 13px; color: #f0e2c0; }
.sup-b-msg { margin-top: 6px; font-size: 15px; color: #fff3d6; font-style: italic; }
@keyframes supIn { from { opacity: 0; transform: translate(-50%, -20px) scale(.9); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
