/* STARFALL ONLINE — UI theme */
:root {
  --bg: #101713;
  --panel: rgba(19, 29, 24, 0.96);
  --panel2: rgba(35, 48, 39, 0.94);
  --line: #52675a;
  --gold: #f1c96f;
  --gold2: #ca8b47;
  --text: #edf0e2;
  --dim: #a5b3a5;
  --hp: #ed665b;
  --mp: #54b8c6;
  --exp: #89c99d;
  --ok: #91cc87;
  --bad: #ed786d;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: 'Sarabun', 'Kanit', system-ui, sans-serif; font-size: 14px; user-select: none; -webkit-user-select: none; }
input, select, button, textarea { font-family: inherit; font-size: inherit; }
input, textarea { user-select: text; -webkit-user-select: text; }
.hidden { display: none !important; }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
#game, #stars { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
code { background: rgba(255,255,255,.1); padding: 1px 6px; border-radius: 4px; }
kbd { display: inline-block; background: #2a2550; border: 1px solid #4c4390; border-bottom-width: 3px; border-radius: 5px; padding: 0 6px; font-size: 12px; min-width: 20px; text-align: center; }

/* ---------------- buttons & inputs */
.btn { background: linear-gradient(#3a3370, #2a2452); color: var(--text); border: 1px solid #5b51a8; border-radius: 8px; padding: 8px 14px; cursor: pointer; transition: transform .08s, filter .15s; font-weight: 600; }
.btn:hover { filter: brightness(1.2); }
.btn:active { transform: translateY(1px); }
.btn-gold { background: linear-gradient(#fcd34d, #d97706); color: #2b1600; border-color: #fde68a; text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.btn-danger { background: linear-gradient(#b91c1c, #7f1d1d); border-color: #f87171; }
.btn-big { padding: 11px 22px; font-size: 16px; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-xs { padding: 2px 7px; font-size: 12px; border-radius: 6px; }
.pulse { animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 14px #fde047; } }
input:not([type=checkbox]):not([type=range]), select { background: #120f2a; color: var(--text); border: 1px solid #4c4390; border-radius: 8px; padding: 8px 10px; outline: none; }
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(251,191,36,.25); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.05); padding: 18px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.row-btns.small { margin-top: 6px; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.ok, .up { color: var(--ok); }
.down { color: var(--bad); }
.hint { color: var(--dim); font-size: 12px; margin-top: 10px; line-height: 1.5; }
.empty-note { color: var(--dim); text-align: center; padding: 18px 8px; }
.empty-note.big { font-size: 16px; }
.section-title { font-family: 'Kanit'; color: var(--gold); margin: 14px 0 6px; font-size: 15px; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.tab { background: #1c1840; border: 1px solid var(--line); color: var(--dim); padding: 6px 12px; border-radius: 8px; cursor: pointer; position: relative; }
.tab.active { background: linear-gradient(#4c3fa0, #2e2670); color: #fff; border-color: #8b7ff0; }
.tab small { display: block; font-size: 10px; opacity: .8; }
.tab .dot { position: absolute; top: 3px; right: 4px; width: 7px; height: 7px; background: #fde047; border-radius: 50%; }
.chip-row, .swatch-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: #1c1840; border: 1px solid var(--line); color: var(--text); padding: 6px 12px; border-radius: 20px; cursor: pointer; }
.chip.active { background: var(--gold); color: #2b1600; border-color: #fde68a; font-weight: 700; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #1c1840; cursor: pointer; }
.swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--gold); }

/* ---------------- screens */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; overflow-y: auto; z-index: 5; }
.logo { text-align: center; }
.logo-main { font-family: 'Press Start 2P', monospace; font-size: clamp(30px, 7vw, 64px); color: #fde68a; text-shadow: 0 4px 0 #b45309, 0 0 30px rgba(251,191,36,.6); letter-spacing: 4px; }
.logo-sub { font-family: 'Press Start 2P', monospace; font-size: clamp(14px, 3vw, 24px); color: #c4b5fd; letter-spacing: 12px; margin-top: 8px; text-shadow: 0 2px 0 #4c1d95; }
.logo-th { font-family: 'Kanit'; font-size: 20px; color: #fef3c7; margin-top: 10px; letter-spacing: 2px; }
.auth-card { width: min(380px, 94vw); }
.auth-card .tabs .tab { flex: 1; }
#auth-form label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; color: var(--dim); font-size: 13px; }
#auth-form .btn { width: 100%; margin-top: 6px; }
.server-status { margin-top: 12px; font-size: 12px; color: var(--dim); text-align: center; line-height: 1.6; }
.footer-note { color: var(--dim); font-size: 12px; }
.screen-title { font-family: 'Kanit'; color: #fde68a; margin: 0; font-size: 28px; text-shadow: 0 2px 0 #7c2d12; }
.account-line { color: var(--dim); }
.char-slots { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.char-slot { width: 170px; min-height: 250px; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px; cursor: pointer; transition: transform .15s, border-color .15s; }
.char-slot:hover { transform: translateY(-3px); border-color: #8b7ff0; }
.char-slot.sel { border-color: var(--gold); box-shadow: 0 0 24px rgba(251,191,36,.35); }
.char-slot.empty { opacity: .7; }
.cs-name { font-family: 'Kanit'; font-size: 17px; font-weight: 600; }
.cs-sub, .cs-map { color: var(--dim); font-size: 12px; }
.cs-guild { color: #a5b4fc; font-size: 12px; }
.cs-plus { font-size: 46px; color: var(--dim); }
.create-wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; max-width: 1000px; }
.create-preview { display: flex; flex-direction: column; align-items: center; background: radial-gradient(circle at 50% 40%, #2d2566, #120f2a 70%); }
.tier-preview { margin-top: 8px; width: 240px; text-align: center; }
.tier-preview .chip { padding: 4px 9px; font-size: 12px; }
.tier-preview .chip-row { justify-content: center; }
.mini-label { font-size: 12px; color: var(--dim); margin: 4px 0; }
.create-form { width: min(560px, 94vw); }
.create-form .lbl { display: block; color: var(--gold); font-family: 'Kanit'; margin: 10px 0 6px; }
.create-form label.lbl input { display: block; width: 100%; margin-top: 4px; }
.class-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.class-card { background: #16132f; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 6px; }
.class-card.active { border-color: var(--c); box-shadow: 0 0 16px color-mix(in srgb, var(--c) 50%, transparent); background: color-mix(in srgb, var(--c) 14%, #16132f); }
.cc-ico { font-size: 28px; grid-row: span 2; align-self: center; }
.cc-name { font-family: 'Kanit'; font-weight: 600; }
.cc-name small { color: var(--dim); margin-left: 6px; font-weight: 400; }
.cc-desc { font-size: 12px; color: var(--dim); }

/* ---------------- modal */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 10000; }
.modal-card { width: min(420px, 94vw); text-align: center; }
.modal-card.wide { width: min(560px, 96vw); max-height: 86vh; overflow-y: auto; }
.modal-text { margin-bottom: 12px; font-size: 15px; }
.modal-card input { width: 100%; }
#conn-lost { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; z-index: 20000; text-align: center; }

/* ---------------- toasts */
#toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 12000; pointer-events: none; width: min(560px, 92vw); }
.toast { background: rgba(15,12,35,.92); border: 1px solid var(--line); border-left: 4px solid #8b7ff0; padding: 8px 16px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.4); transition: opacity .5s, transform .5s; font-weight: 600; text-align: center; }
.toast.error { border-left-color: var(--bad); color: #fecaca; }
.toast.levelup { border-left-color: var(--gold); color: #fde68a; }
.toast.death { border-left-color: #6b7280; color: #e5e7eb; }
.toast.quest { border-left-color: var(--ok); color: #bbf7d0; }
.toast.out { opacity: 0; transform: translateY(-10px); }

/* ---------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
.hud-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 18px rgba(0,0,0,.45); }
#hud-player { position: absolute; top: 10px; left: 10px; display: flex; gap: 8px; padding: 8px; width: 290px; }
#hud-avatar { width: 56px; height: 56px; border-radius: 10px; background: radial-gradient(circle, #3b2f80, #151232); border: 2px solid var(--gold2); }
.hp-col { flex: 1; min-width: 0; }
.hud-name { font-family: 'Kanit'; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-badge { background: var(--gold); color: #2b1600; border-radius: 6px; padding: 0 5px; font-size: 12px; font-weight: 700; }
.class-badge { font-size: 12px; color: var(--dim); }
.bar { position: relative; height: 13px; background: #0a0816; border: 1px solid #2a2452; border-radius: 6px; overflow: hidden; margin-top: 3px; }
.bar > div { height: 100%; transition: width .2s; }
.bar > span { position: absolute; inset: 0; font-size: 10px; line-height: 12px; text-align: center; text-shadow: 0 1px 2px #000; font-weight: 700; }
.bar.hp > div { background: linear-gradient(#f87171, #b91c1c); }
.bar.mp > div { background: linear-gradient(#60a5fa, #1d4ed8); }
.bar.exp > div { background: linear-gradient(#c084fc, #7e22ce); }
.bar.mini { height: 5px; margin-top: 2px; }
.hud-gold { font-size: 12px; margin-top: 3px; color: #fde68a; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.diamonds-badge { background: rgba(56, 189, 248, 0.18); border: 1px solid #38bdf8; color: #7dd3fc; border-radius: 6px; padding: 0 5px; font-weight: 700; font-size: 11px; cursor: pointer; transition: all .15s; }
.diamonds-badge:hover { background: #0284c7; color: #fff; transform: scale(1.05); }
.vip-badge { background: linear-gradient(135deg, #b45309, #d97706); color: #fef08a; border: 1px solid #fde047; border-radius: 6px; padding: 0 5px; font-weight: 800; font-size: 11px; cursor: pointer; transition: all .15s; }
.vip-badge:hover { filter: brightness(1.2); transform: scale(1.05); }
.points-badge { background: #16a34a; color: #fff; border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 700; cursor: pointer; animation: pulse 1.4s infinite; }
#buff-bar { position: absolute; top: 96px; left: 12px; display: flex; gap: 4px; }
.buff { width: 30px; height: 30px; background: var(--panel); border: 1px solid var(--gold2); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 16px; position: relative; }
.buff span { position: absolute; bottom: -2px; right: 1px; font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000; }
#party-frame { position: absolute; top: 132px; left: 10px; width: 200px; padding: 6px; }
.pf-title { font-size: 12px; color: var(--gold); font-weight: 700; margin-bottom: 3px; }
.pf-row { padding: 3px 4px; border-radius: 6px; cursor: pointer; }
.pf-row:hover { background: rgba(255,255,255,.06); }
.pf-row.me { background: rgba(251,191,36,.08); }
.pf-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#target-frame { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 300px; padding: 6px 10px; text-align: center; }
#target-name { font-weight: 700; font-size: 13px; }
#target-name.hostile { color: #fca5a5; }
#target-name.friendly { color: #93c5fd; }
#war-bar { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); background: linear-gradient(90deg, rgba(127,29,29,.92), rgba(30,27,75,.92)); border: 1px solid #f87171; border-radius: 10px; padding: 5px 14px; font-weight: 600; white-space: nowrap; font-size: 13px; }
.ally { color: #86efac; }
.enemy { color: #fca5a5; }
.war-time { margin-left: 8px; color: #fde68a; }
#duel-overlay { position: absolute; top: 28%; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; }
.duel-count { font-family: 'Press Start 2P'; font-size: 54px; color: #fde68a; text-shadow: 0 4px 0 #b45309, 0 0 30px #f59e0b; }
.duel-vs { font-family: 'Kanit'; font-size: 20px; text-shadow: 0 2px 4px #000; }
.duel-vs.small { font-size: 15px; background: rgba(0,0,0,.5); padding: 4px 12px; border-radius: 8px; }
#minimap-box { position: absolute; top: 10px; right: 10px; padding: 6px; width: 182px; }
.mm-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: #fde68a; margin-bottom: 4px; gap: 4px; }
.mm-head span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-range { color: var(--dim); font-weight: 400; white-space: nowrap; }
#minimap { width: 168px; height: 168px; border-radius: 8px; border: 1px solid #2a2452; cursor: crosshair; display: block; }
#minimap-box.collapsed { width: auto; }
#minimap-box.collapsed #minimap, #minimap-box.collapsed .mm-foot { display: none; }
#minimap-box.collapsed .mm-head { margin-bottom: 0; }
#minimap-box.collapsed #mm-range { display: none; }
.mm-head .mm-btn { margin-left: auto; flex: 0 0 22px; }
.mm-foot { display: flex; gap: 6px; align-items: center; font-size: 11px; color: var(--dim); margin-top: 4px; }
.mm-btn { margin-left: auto; width: 22px; height: 22px; background: #2a2452; border: 1px solid #5b51a8; color: #fff; border-radius: 6px; cursor: pointer; padding: 0; }
.mm-btn + .mm-btn { margin-left: 0; }
#bot-panel { position: absolute; top: 232px; right: 10px; width: 182px; padding: 4px 6px; display: flex; flex-direction: column; gap: 3px; z-index: 5; }
.btn-bot { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 8px; border-radius: 8px; border: 1px solid #4b5563; background: #1c1840; color: var(--text); font-weight: 700; font-size: 13px; cursor: pointer; transition: all .2s; }
.btn-bot:hover { filter: brightness(1.2); }
.btn-bot.active { background: linear-gradient(135deg, #059669, #10b981); border-color: #a7f3d0; color: #fff; box-shadow: 0 0 12px rgba(16,185,129,.45); }
.btn-bot .hotkey { font-size: 11px; opacity: 0.7; font-weight: normal; }
.bot-status { font-size: 11px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.bot-status.active { color: #86efac; font-weight: 600; }
#gift-btn { position: absolute; top: 284px; right: 10px; width: 182px; padding: 6px; color: var(--text); cursor: pointer; font-weight: 700; font-size: 13px; }
#gift-btn.ready { background: linear-gradient(#f472b6, #be185d); border-color: #fbcfe8; animation: pulse 1.2s infinite; }
#quest-tracker { position: absolute; top: 322px; right: 10px; width: 182px; background: rgba(12,10,28,.72); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; cursor: pointer; max-height: 32vh; overflow-y: auto; }
.qt-head { font-size: 12px; color: var(--gold); font-weight: 700; }
.qt-empty { font-size: 11px; color: var(--dim); }
.qt-row { margin-top: 4px; font-size: 12px; }
.qt-name { font-weight: 600; }
.qt-prog { color: var(--dim); font-size: 11px; }
.qt-row.done .qt-prog { color: var(--ok); }
#skillbar { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.sk { width: 50px; height: 50px; border-radius: 9px; border: 2px solid var(--c, #5b51a8); background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c, #5b51a8) 45%, #1a1638), #110e26); position: relative; cursor: pointer; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.sk:hover { filter: brightness(1.25); }
.sk .ico { font-size: 25px; }
.sk .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.7); }
.sk .cdt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; text-shadow: 0 1px 3px #000; }
.sk .key { position: absolute; top: 1px; left: 3px; font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.sk .lock { position: absolute; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fca5a5; }
.sk.locked .ico { filter: grayscale(1); }
.sk.nomp { box-shadow: inset 0 0 0 50px rgba(30,64,175,.35); }
.sk.pot { --c: #7c2d12; }
.sk.pot[data-pot=mp] { --c: #1e3a8a; }
.sk.pot img { width: 34px; height: 34px; }
.sk.pot.empty img { opacity: .3; }
.sk .cnt { position: absolute; bottom: 1px; right: 3px; font-size: 11px; font-weight: 700; text-shadow: 0 1px 2px #000; }
#expbar { position: absolute; bottom: 4px; left: 8px; right: 8px; height: 16px; background: #0a0816; border: 1px solid #2a2452; border-radius: 8px; overflow: hidden; }
#expfill { height: 100%; background: linear-gradient(90deg, #7e22ce, #c084fc); transition: width .3s; }
#exptxt { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 15px; font-weight: 700; text-shadow: 0 1px 2px #000; }
#menubar { position: absolute; bottom: 26px; right: 10px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 5px; }
#menubar button { width: 46px; height: 42px; background: #1c1840; border: 1px solid var(--line); border-radius: 8px; color: var(--text); cursor: pointer; font-size: 17px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; line-height: 1; }
#menubar button span { font-size: 9px; margin-top: 2px; color: var(--dim); }
#menubar button:hover { background: #2e2670; border-color: var(--gold2); }
#chat { position: absolute; bottom: 26px; left: 10px; width: min(420px, 40vw); background: rgba(12,10,28,.88); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; z-index: 30; box-shadow: 0 4px 20px rgba(0,0,0,.5); }
#chat.closed { display: none !important; }
.chat-tabs { display: flex; gap: 2px; padding: 4px 6px 0; align-items: center; }
.chat-tabs button { background: transparent; border: 0; color: var(--dim); cursor: pointer; font-size: 11px; padding: 3px 6px; border-radius: 6px 6px 0 0; }
.chat-tabs button.active { background: #2a2452; color: #fff; font-weight: 600; }
.chat-actions { margin-left: auto; display: flex; gap: 3px; align-items: center; }
.chat-min, .chat-close { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 4px; color: var(--dim); cursor: pointer; font-size: 11px; padding: 0; transition: all .15s; }
.chat-min:hover, .chat-close:hover { background: #3a3370; color: #fff; }
.chat-close:hover { background: #b91c1c; border-color: #f87171; color: #fff; }
#chat-log { height: 150px; overflow-y: auto; padding: 4px 8px; font-size: 13px; line-height: 1.45; user-select: text; }
#chat.min #chat-log { height: 0; padding: 0; display: none; }
.cl { word-break: break-word; }
.cl .tag { color: var(--dim); font-size: 11px; }
.cl .nm { color: #c4b5fd; cursor: pointer; font-weight: 600; }
.cl .nm.gm { color: var(--gold); }
.tag-vip { font-weight: 800; font-size: 10px; padding: 1px 5px; border-radius: 4px; margin-right: 3px; display: inline-block; }
.tag-vip.vip-0 { display: none; }
.tag-vip.vip-1 { background: #334155; color: #cbd5e1; }
.tag-vip.vip-2 { background: #15803d; color: #bbf7d0; }
.tag-vip.vip-3 { background: #1d4ed8; color: #bfdbfe; }
.tag-vip.vip-4 { background: #7e22ce; color: #e9d5ff; }
.tag-vip.vip-5 { background: #c2410c; color: #fed7aa; }
.tag-vip.vip-6 { background: #b91c1c; color: #fecaca; }
.tag-vip.vip-7 { background: linear-gradient(135deg, #b91c1c, #d97706, #7e22ce); color: #fff; box-shadow: 0 0 8px rgba(251,191,36,0.6); animation: vipglow 1.5s infinite alternate; }
.ch-world .tag { color: #fdba74; }
.ch-party .tag, .ch-party { color: #86efac; }
.ch-guild .tag, .ch-guild { color: #93c5fd; }
.ch-w, .ch-w .tag { color: #f9a8d4; }
.ch-sys { color: #d8b4fe; }
.ch-notice { color: #fde68a; font-weight: 700; }
#chat-form { display: flex; gap: 4px; padding: 5px; background: rgba(0,0,0,0.25); border-radius: 0 0 var(--radius) var(--radius); }
#chat-ch { padding: 5px 6px; width: 82px; background: #1c1840; border: 1px solid var(--line); border-radius: 6px; color: var(--text); font-size: 12px; }
#chat-to { width: 88px; padding: 5px 7px; background: #1c1840; border: 1px solid var(--line); border-radius: 6px; color: var(--text); font-size: 12px; }
#chat-input { flex: 1; min-width: 0; padding: 5px 8px; background: #16132f; border: 1px solid var(--line); border-radius: 6px; color: #fff; font-size: 13px; }
#chat-input:focus { outline: none; border-color: var(--gold2); box-shadow: 0 0 6px rgba(251,191,36,.3); background: #1c1840; }
#chat-send { padding: 4px 10px; font-weight: 700; font-size: 12px; cursor: pointer; flex-shrink: 0; }
#chat-open-btn { position: absolute; bottom: 26px; left: 10px; height: 34px; padding: 4px 12px; display: flex; align-items: center; gap: 6px; background: rgba(12,10,28,.88); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font-weight: 700; font-size: 12px; cursor: pointer; z-index: 30; transition: all .2s; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
#chat-open-btn:hover { background: #2a2452; border-color: var(--gold2); color: #fff; transform: translateY(-2px); }
#loot-feed { position: absolute; bottom: 140px; right: 10px; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; pointer-events: none; }
.loot-item { background: rgba(12,10,28,.82); border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; font-size: 13px; font-weight: 600; display: flex; gap: 6px; align-items: center; transition: opacity .6s; }
.loot-item img { width: 22px; height: 22px; }
.loot-item.out { opacity: 0; }

/* ---------------- panels */
#panels .panel { position: absolute; background: var(--panel); border: 1px solid #5b51a8; border-radius: 14px; box-shadow: 0 16px 50px rgba(0,0,0,.6); max-height: calc(100vh - 150px); display: flex; flex-direction: column; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: linear-gradient(#2e2670, #1d1850); border-radius: 14px 14px 0 0; font-family: 'Kanit'; font-weight: 600; color: #fde68a; cursor: move; }
.panel-x { background: #3a3370; border: 1px solid #5b51a8; color: #fff; width: 26px; height: 26px; border-radius: 7px; cursor: pointer; }
.panel-x:hover { background: #b91c1c; }
.panel-body { padding: 12px; overflow-y: auto; }
.inline-form { display: flex; gap: 6px; margin: 6px 0 10px; }
.inline-form input { flex: 1; min-width: 0; }
.list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.list-row { display: flex; gap: 8px; align-items: center; background: #16132f; border: 1px solid #262050; border-radius: 8px; padding: 6px 8px; }
.lr-main { flex: 1; min-width: 0; }
.lr-act { display: flex; gap: 3px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot.off { background: #4b5563; }
.rank-chip { font-size: 11px; background: #2a2452; border-radius: 5px; padding: 0 5px; }
.rank-chip.master { background: #92400e; color: #fde68a; }
.rank-chip.officer { background: #1e3a8a; color: #bfdbfe; }

/* character */
.char-head { display: flex; gap: 14px; align-items: center; }
.char-head canvas { background: radial-gradient(circle, #2d2566, #120f2a 75%); border-radius: 12px; border: 1px solid var(--line); }
.big-name { font-family: 'Kanit'; font-size: 20px; font-weight: 700; color: #fde68a; }
.attr-grid { display: flex; flex-direction: column; gap: 4px; }
.attr-row { display: flex; align-items: center; gap: 6px; background: #16132f; border-radius: 8px; padding: 4px 8px; }
.attr-k { width: 42px; font-weight: 700; color: #c4b5fd; }
.attr-v { width: 40px; font-weight: 700; font-size: 16px; }
.attr-base { color: var(--dim); font-size: 12px; flex: 1; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.stat-grid b { float: right; color: #fff; }
.stat-grid.small { font-size: 12px; }

/* inventory */
.inv-wrap { display: flex; gap: 12px; flex-wrap: wrap; }
.paperdoll { flex: 0 0 250px; }
.pd-grid { display: grid; grid-template-columns: 54px 1fr 54px; grid-template-areas: "head center neck" "weapon center ring" "body center hands" "feet center ."; gap: 6px; background: radial-gradient(circle at 50% 45%, #2d2566, #120f2a 75%); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.pd-slot[data-slot=head] { grid-area: head; } .pd-slot[data-slot=neck] { grid-area: neck; } .pd-slot[data-slot=weapon] { grid-area: weapon; } .pd-slot[data-slot=ring] { grid-area: ring; }
.pd-slot[data-slot=body] { grid-area: body; } .pd-slot[data-slot=hands] { grid-area: hands; } .pd-slot[data-slot=feet] { grid-area: feet; }
.pd-center { grid-area: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pd-rot { display: flex; gap: 4px; }
.pd-stats { font-size: 12px; margin: 6px 0 2px; text-align: center; }
.bag { flex: 1; min-width: 260px; }
.bag-grid, .smith-grid { display: grid; grid-template-columns: repeat(auto-fill, 48px); gap: 5px; }
.bag-foot { display: flex; justify-content: space-between; margin-top: 8px; font-weight: 600; color: #fde68a; }
.slot { width: 48px; height: 48px; background: #0f0c24; border: 2px solid #2a2452; border-radius: 8px; position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.slot img { width: 36px; height: 36px; pointer-events: none; }
.slot.empty { cursor: default; opacity: .8; }
.slot.g0 { border-color: #6b7280; }
.slot.g1 { border-color: #22c55e; box-shadow: inset 0 0 8px rgba(34,197,94,.35); }
.slot.g2 { border-color: #3b82f6; box-shadow: inset 0 0 10px rgba(59,130,246,.45); }
.slot.g3 { border-color: #a855f7; box-shadow: inset 0 0 12px rgba(168,85,247,.55), 0 0 8px rgba(168,85,247,.4); }
.slot.g4 { border-color: #f97316; box-shadow: inset 0 0 14px rgba(249,115,22,.6), 0 0 12px rgba(249,115,22,.55); animation: legend 2s infinite; }
@keyframes legend { 50% { box-shadow: inset 0 0 14px rgba(250,204,21,.7), 0 0 16px rgba(250,204,21,.6); } }
.slot.g5 { border-color: #ff2a5f; box-shadow: inset 0 0 16px rgba(255,42,95,.7), 0 0 16px rgba(255,42,95,.6); animation: godglow 1.8s infinite; }
@keyframes godglow { 0% { box-shadow: inset 0 0 14px rgba(255,42,95,.6), 0 0 12px rgba(255,42,95,.5); border-color: #ff2a5f; } 50% { box-shadow: inset 0 0 20px rgba(255,215,0,.8), 0 0 22px rgba(255,42,95,.8); border-color: #ffd700; } 100% { box-shadow: inset 0 0 14px rgba(255,42,95,.6), 0 0 12px rgba(255,42,95,.5); border-color: #ff2a5f; } }
.slot.cant::after { content: ''; position: absolute; inset: 0; background: rgba(185,28,28,.28); border-radius: 6px; }
.slot.sel { outline: 2px solid var(--gold); outline-offset: 1px; }
.slot:hover { filter: brightness(1.3); }
.slot .plus { position: absolute; top: 0; right: 2px; font-size: 11px; font-weight: 800; color: #fde047; text-shadow: 0 1px 2px #000; }
.slot .qty { position: absolute; bottom: 0; right: 3px; font-size: 11px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.slot-label { font-size: 10px; color: #5b5490; text-align: center; }

/* tooltip & item popup */
#tooltip, #item-pop { position: fixed; z-index: 9500; background: rgba(12,10,28,.97); border: 1px solid #6d5fd8; border-radius: 10px; padding: 9px 12px; max-width: 300px; font-size: 13px; line-height: 1.45; box-shadow: 0 8px 30px rgba(0,0,0,.6); pointer-events: none; }
#item-pop { pointer-events: auto; }
.pop-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tt-title { font-family: 'Kanit'; font-weight: 700; font-size: 15px; }
.tt-sub { color: var(--dim); font-size: 12px; }
.tt-dim { color: var(--dim); font-size: 12px; }
.tt-bad { color: var(--bad); font-size: 12px; }
.tt-bonus { color: #86efac; }
.tt-plus { color: #fde047; font-size: 12px; }
.tt-sep { border-top: 1px solid #2a2452; margin: 5px 0; }
.tt-set { color: #fbbf24; font-weight: 700; }
.tt-set-on { color: #fde68a; font-size: 12px; }
.tt-price { color: #fbbf24; font-size: 12px; margin-top: 4px; }
.tt-cmp span { margin-right: 6px; font-size: 12px; font-weight: 700; }

/* skills */
.skill-row { display: flex; gap: 10px; background: #16132f; border: 1px solid #262050; border-left: 4px solid var(--c); border-radius: 10px; padding: 8px; margin-top: 8px; }
.skill-row.locked { opacity: .55; }
.skill-ico { font-size: 30px; width: 44px; text-align: center; }
.skill-info { flex: 1; font-size: 13px; }
.key-chip { background: #2a2452; border-radius: 4px; padding: 0 5px; font-size: 11px; }

/* quests */
.quest-tabs .tab { font-size: 12px; padding: 5px 9px; }
.quest-map-info { background: #16132f; border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; font-size: 13px; }
.quest-list { display: flex; flex-direction: column; gap: 8px; }
.quest-card { background: #16132f; border: 1px solid #262050; border-left: 4px solid #4b5563; border-radius: 10px; padding: 8px 10px; }
.quest-card.st-avail { border-left-color: #fde047; }
.quest-card.st-active { border-left-color: #60a5fa; }
.quest-card.st-complete { border-left-color: var(--ok); background: rgba(22,101,52,.18); }
.quest-card.st-locked, .quest-card.st-done { opacity: .6; }
.qc-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.qc-lv { background: #2a2452; border-radius: 5px; padding: 0 6px; font-size: 11px; font-weight: 700; color: #c4b5fd; }
.qc-state { font-size: 11px; margin-left: auto; color: var(--dim); }
.st-avail .qc-state { color: #fde047; } .st-complete .qc-state { color: var(--ok); font-weight: 700; } .st-active .qc-state { color: #93c5fd; }
.qc-rep { font-size: 11px; color: #a5b4fc; }
.qc-desc { font-size: 13px; margin: 3px 0; }
.qc-meta { font-size: 12px; color: var(--dim); }
.qc-bar { height: 14px; margin: 5px 0; }
.qc-reward { font-size: 12px; margin-top: 4px; }
.qc-actions { display: flex; gap: 6px; margin-top: 6px; justify-content: flex-end; }
.rw { display: inline-flex; align-items: center; gap: 3px; background: #0f0c24; border-radius: 5px; padding: 1px 6px; margin: 1px 2px 1px 0; }
.rw img { width: 16px; height: 16px; }
.rw.exp { color: #d8b4fe; } .rw.gold { color: #fde68a; }

/* guild */
.guild-head { text-align: center; }
.guild-name { font-family: 'Kanit'; font-size: 22px; font-weight: 700; color: #fde68a; }
.guild-notice { background: #16132f; border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; }
.guild-info { background: #16132f; border-radius: 10px; padding: 12px; line-height: 1.6; }
.war-box { background: linear-gradient(90deg, rgba(127,29,29,.5), rgba(30,27,75,.5)); border: 1px solid #f87171; border-radius: 8px; padding: 8px 10px; }
.war-history { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.wh { font-size: 11px; background: #2a2452; border-radius: 5px; padding: 1px 6px; }
.wh.win { background: #14532d; color: #bbf7d0; } .wh.lose { background: #7f1d1d; color: #fecaca; }

/* rank */
.rank-table { width: 100%; border-collapse: collapse; }
.rank-table td { padding: 6px 8px; border-bottom: 1px solid #262050; }
.rank-table .rk { width: 40px; text-align: center; font-weight: 700; }
.rank-table .rv { text-align: right; font-weight: 700; color: #fde68a; white-space: nowrap; }
.rank-table tr.top1 { background: rgba(251,191,36,.12); }

/* world map */
.wm-list { display: flex; flex-direction: column; gap: 6px; }
.wm-row { background: #16132f; border: 1px solid #262050; border-radius: 10px; padding: 8px 10px; }
.wm-row.here { border-color: var(--gold); }
.wm-row.lock { opacity: .6; }
.wm-name { font-family: 'Kanit'; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.wm-name small { color: var(--dim); font-weight: 400; }
.wm-lv { margin-left: auto; color: #c4b5fd; font-size: 13px; }
.wm-mobs span { color: #fca5a5; }
.wm-mobs .elite { color: #fb923c; font-weight: 700; }
.wm-mobs .boss { color: #ef4444; font-weight: 800; }

/* settings */
.set-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 12px; }

/* hotkeys panel */
.hotkeys-container { display: flex; flex-direction: column; gap: 10px; max-height: calc(85vh - 90px); overflow-y: auto; padding-right: 4px; }
.hk-desc-top { font-size: 12px; padding: 7px 10px; background: rgba(99,102,241,0.12); border-left: 3px solid #6366f1; border-radius: 6px; color: #cbd5e1; }
.hk-section { background: #16132f; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.hk-title { font-weight: 700; font-size: 13px; color: var(--gold); margin-bottom: 7px; padding-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.hk-grid { display: flex; flex-direction: column; gap: 5px; }
.hk-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 2px 0; }
.hk-keys { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; min-width: 140px; }
.hk-desc { color: #e2e8f0; flex: 1; text-align: right; }
.hk-keys kbd { background: #231f47; border-color: #6366f1; color: #fbbf24; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.4); }

/* shop & smith */
.shop-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.gold-chip { margin-left: auto; background: #2a2452; border-radius: 8px; padding: 3px 10px; color: #fde68a; font-weight: 700; }
.mine-toggle { margin-left: auto; font-size: 12px; display: flex; gap: 4px; align-items: center; }
.shop-list { display: flex; flex-direction: column; gap: 5px; }
.shop-row { display: flex; align-items: center; gap: 8px; background: #16132f; border-radius: 8px; padding: 5px 8px; }
.sr-info { flex: 1; min-width: 0; }
.sr-price { color: #fde68a; font-weight: 700; white-space: nowrap; }
.sr-price.bad { color: var(--bad); }
.qty-in { width: 64px; padding: 4px 6px !important; }
.smith-wrap { display: flex; gap: 12px; flex-wrap: wrap; }
.smith-pick { flex: 1; min-width: 240px; }
.smith-detail { flex: 1; min-width: 260px; background: #16132f; border-radius: 10px; padding: 10px; }
.smith-item { margin-bottom: 8px; }
.smith-box { background: #0f0c24; border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.smith-result { font-family: 'Kanit'; font-size: 22px; text-align: center; min-height: 30px; }
.smith-result.ok { color: #fde047; animation: pop .5s; }
.smith-result.fail { color: #f87171; animation: shake .4s; }
@keyframes pop { 0% { transform: scale(.5); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* inspect */
.insp-eq { display: flex; flex-direction: column; gap: 4px; }
.insp-row { display: flex; align-items: center; gap: 10px; }

/* VIP & Recharge Panel */
.vip-header-card { background: linear-gradient(135deg, #1b1640, #2b1f55); border: 1px solid #6366f1; border-radius: 12px; padding: 12px; margin-bottom: 12px; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.vh-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.vh-badge { display: flex; align-items: center; gap: 10px; }
.vh-icon { font-size: 28px; }
.vh-title { font-family: 'Kanit'; font-size: 18px; font-weight: 700; }
.vh-sub { font-size: 12px; }
.vh-balance { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dia-chip { background: #0c4a6e; border: 1px solid #38bdf8; border-radius: 8px; padding: 3px 10px; color: #7dd3fc; font-weight: 700; font-size: 13px; }
.vip-exp-bar { position: relative; height: 16px; background: #0a0818; border: 1px solid #4338ca; border-radius: 8px; overflow: hidden; }
.vip-exp-fill { height: 100%; background: linear-gradient(90deg, #f59e0b, #ef4444, #ec4899); transition: width 0.3s ease; }
.vip-exp-txt { position: absolute; inset: 0; font-size: 10.5px; line-height: 16px; text-align: center; font-weight: 700; text-shadow: 0 1px 2px #000; color: #fff; }

.redeem-bar { display: flex; gap: 8px; margin-bottom: 14px; background: #16132f; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.redeem-bar input { flex: 1; min-width: 0; background: #0f0c24; border: 1px solid #3a3370; border-radius: 6px; padding: 7px 10px; color: #fff; font-size: 13px; }
.redeem-bar input:focus { outline: none; border-color: var(--gold); }

.vip-packs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 12px; }
.pack-card { background: #16132f; border: 1px solid #312e81; border-radius: 12px; padding: 12px 10px; text-align: center; position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .2s, border-color .2s; }
.pack-card:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 6px 20px rgba(0,0,0,0.4); }
.pack-card.pack-hot { border: 2px solid #f59e0b; background: radial-gradient(circle at 50% 0%, #311b59, #16132f); }
.pack-badge { position: absolute; top: -8px; right: 8px; background: linear-gradient(135deg, #ef4444, #f59e0b); color: #fff; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.pack-badge.pet-free { background: linear-gradient(135deg, #10b981, #059669); top: -8px; left: 8px; right: auto; }
.pack-icon { font-size: 32px; margin: 4px 0; }
.pack-title { font-weight: 700; font-size: 13.5px; color: #fde68a; }
.pack-gems { font-size: 14px; font-weight: 800; color: #38bdf8; }
.pack-exp { font-size: 11.5px; }
.pack-card .btn { width: 100%; margin-top: 6px; }

.vip-daily-card { display: flex; justify-content: space-between; align-items: center; background: #16132f; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.vip-table-wrap { overflow-x: auto; max-height: calc(75vh - 220px); border-radius: 10px; border: 1px solid var(--line); }
.vip-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.vip-table th { background: #1d1850; padding: 8px 10px; text-align: left; font-weight: 700; color: #fde68a; border-bottom: 1px solid #3730a3; position: sticky; top: 0; z-index: 2; }
.vip-table td { padding: 8px 10px; border-bottom: 1px solid #231f47; }
.vip-table tr:hover { background: rgba(255,255,255,0.03); }
.vip-table tr.my-vip-row { background: rgba(245, 158, 11, 0.15); border-left: 3px solid #f59e0b; }

.god-shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.god-item-card { background: #16132f; border: 1px solid #3b2f80; border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.god-item-card:hover { border-color: #ff2a5f; }
.gic-title { font-weight: 700; font-size: 13.5px; }
.gic-stats { font-size: 12px; line-height: 1.4; margin: 3px 0; }
.god-item-card .btn { margin-top: auto; }

.pets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.pet-card { background: #16132f; border: 1px solid #3b2f80; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.pet-card.pet-active { border: 2px solid #10b981; background: radial-gradient(circle at 100% 0%, rgba(16,185,129,0.12), #16132f); box-shadow: 0 0 14px rgba(16,185,129,0.25); }
.pet-head { display: flex; align-items: center; gap: 10px; }
.pet-big-icon { font-size: 32px; }
.pet-name { font-weight: 800; font-size: 15px; }
.pet-status-badge { margin-left: auto; background: #065f46; color: #a7f3d0; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700; }
.pet-desc { font-size: 12px; font-style: italic; }
.pet-stats-box { background: #0f0c24; border-radius: 8px; padding: 7px 10px; font-size: 12px; }
.pet-stats-title { font-weight: 700; color: #fde68a; margin-bottom: 4px; }
.pet-stats-list { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; }
.pet-card .btn { margin-top: 4px; }


/* NPC dialog */
#npc-dialog { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(660px, 96vw); background: var(--panel); border: 2px solid var(--gold2); border-radius: 14px; display: flex; gap: 12px; padding: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.6); z-index: 50; max-height: 60vh; }
.npc-portrait canvas { background: radial-gradient(circle, #3b2f80, #151232); border-radius: 10px; border: 1px solid var(--line); }
.npc-main { flex: 1; overflow-y: auto; min-width: 0; }
.npc-name { font-family: 'Kanit'; font-size: 17px; font-weight: 700; color: #fde68a; }
.npc-name small { color: #fcd34d; font-weight: 400; font-size: 12px; }
.npc-talk { margin: 4px 0 10px; font-style: italic; color: #e0dcf5; }
.npc-opts { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.npc-x { position: absolute; top: 8px; right: 8px; }
.npc-quests { width: 100%; display: flex; flex-direction: column; gap: 5px; }
.npc-q { display: flex; gap: 8px; align-items: center; justify-content: space-between; background: #16132f; border-radius: 8px; padding: 6px 8px; border-left: 3px solid #4b5563; }
.npc-q.avail { border-left-color: #fde047; } .npc-q.complete { border-left-color: var(--ok); } .npc-q.active { border-left-color: #60a5fa; } .npc-q.locked, .npc-q.prev { opacity: .55; }
.tp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; width: 100%; }
.tp-btn { display: flex; flex-direction: column; text-align: left; }
.tp-btn small { color: var(--dim); font-weight: 400; }
.tp-btn.locked { opacity: .5; }

/* prompts & context menu */
#prompts { position: absolute; right: 204px; top: 10px; display: flex; flex-direction: column; gap: 8px; width: 290px; z-index: 60; }
.prompt { background: var(--panel); border: 2px solid #8b7ff0; border-radius: 12px; padding: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.5); animation: slidein .3s; position: relative; overflow: hidden; }
.prompt.duel, .prompt.war { border-color: #f87171; }
.prompt.guild { border-color: #60a5fa; }
.prompt-timer { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--gold); animation: timer 60s linear forwards; }
@keyframes timer { from { width: 100%; } to { width: 0; } }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
#ctx-menu { position: fixed; z-index: 9000; background: rgba(12,10,28,.97); border: 1px solid #6d5fd8; border-radius: 10px; padding: 4px; min-width: 180px; display: flex; flex-direction: column; box-shadow: 0 8px 30px rgba(0,0,0,.6); }
.ctx-head { padding: 6px 8px; font-weight: 700; color: #fde68a; border-bottom: 1px solid #2a2452; margin-bottom: 3px; }
.ctx-head small { color: var(--dim); font-weight: 400; }
#ctx-menu button { background: transparent; border: 0; color: var(--text); text-align: left; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
#ctx-menu button:hover { background: #2e2670; }

/* death */
#death-overlay { position: absolute; inset: 0; background: radial-gradient(circle, rgba(60,0,0,.35), rgba(0,0,0,.75)); display: flex; align-items: center; justify-content: center; z-index: 70; }
.death-card { text-align: center; }
.death-title { font-family: 'Kanit'; font-size: 42px; color: #fca5a5; text-shadow: 0 3px 0 #7f1d1d; }
.death-sub { color: var(--dim); margin: 8px 0 16px; }

/* touch */
#joystick { position: absolute; left: 24px; bottom: 210px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.2); touch-action: none; }
#joy-knob { position: absolute; left: 35px; top: 35px; width: 40px; height: 40px; border-radius: 50%; background: rgba(251,191,36,.6); border: 2px solid #fde68a; pointer-events: none; }
#mobile-actions { position: absolute; right: 20px; bottom: 200px; display: flex; flex-direction: column; gap: 10px; }
#mobile-actions button { width: 64px; height: 64px; border-radius: 50%; font-size: 26px; background: rgba(185,28,28,.7); border: 2px solid #fca5a5; color: #fff; }
#mobile-actions button + button { background: rgba(30,58,138,.7); border-color: #93c5fd; width: 50px; height: 50px; font-size: 20px; align-self: flex-end; }
#mobile-actions #mob-auto { background: rgba(5,150,105,.75); border-color: #6ee7b7; }
#mobile-actions #mob-auto.active { background: #10b981; border-color: #fff; box-shadow: 0 0 12px #34d399; }
.mobile-only { display: none !important; }
#mobile-menu-toggle { display: none; }

/* ---------------- responsive */
@media (max-width: 900px) {
  #hud-player { width: 230px; }
  #quest-tracker { display: none; }
  #chat { width: min(300px, 58vw); bottom: 94px; }
  #chat-open-btn { bottom: 94px; left: 10px; }
  #chat-log { height: 90px; font-size: 12px; }
  #menubar { grid-template-columns: repeat(6, 1fr); bottom: auto; top: 250px; right: 6px; }
  #menubar button { width: 34px; height: 34px; font-size: 14px; }
  #menubar button span { display: none; }
  #minimap-box { width: 128px; }
  #minimap { width: 114px; height: 114px; }
  .mm-foot span:nth-child(3) { display: none; }
  #bot-panel { top: 184px; width: 128px; font-size: 11px; padding: 2px 4px; }
  .btn-bot { font-size: 11px; padding: 4px 6px; }
  #gift-btn { top: 238px; width: 128px; font-size: 11px; }
  #skillbar { gap: 3px; padding: 4px; bottom: 24px; max-width: calc(100vw - 12px); }
  .sk { width: 38px; height: 38px; }
  .sk .ico { font-size: 18px; }
  .sk.pot img { width: 26px; height: 26px; }
  #target-frame { width: 200px; top: 64px; }
  #war-bar { top: 108px; font-size: 11px; }
  #prompts { right: 8px; top: 300px; width: 250px; }
  #panels .panel { left: 2vw !important; top: 8px !important; max-height: calc(100vh - 100px); }
  #npc-dialog { bottom: 80px; }
  .npc-portrait { display: none; }
  #party-frame { width: 160px; }
  #loot-feed { bottom: 190px; }
  #joystick { bottom: 172px; left: 16px; }
  #mobile-actions { bottom: 172px; right: 14px; }
}

@media (max-width: 540px) {
  #menubar { grid-template-columns: repeat(4, 1fr); top: 220px; right: 4px; }
  #menubar button { width: 31px; height: 31px; font-size: 13px; }
  #skillbar { gap: 2px; padding: 2px; bottom: 22px; }
  .sk { width: 31px; height: 34px; border-radius: 6px; border-width: 1.5px; }
  .sk .ico { font-size: 15px; }
  .sk .key { font-size: 8px; top: 0; left: 1px; }
  .sk .lock { font-size: 8px; }
  .sk .cdt { font-size: 11px; }
  .sk.pot img { width: 22px; height: 22px; }
  .sk .cnt { font-size: 9px; right: 1px; bottom: 0; }
  .hk-keys { min-width: 110px; }
  .hk-row { font-size: 11.5px; }
}

@media (max-width: 900px) {
  #bot-panel { display: none; }
  #mobile-menu-toggle { position: absolute; top: 164px; right: 8px; z-index: 61; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; color: var(--text); background: var(--panel); border: 1px solid var(--gold2); border-radius: 8px; font-size: 20px; cursor: pointer; }
  #menubar { display: none; top: 212px; right: 8px; bottom: auto; grid-template-columns: repeat(4, 46px); gap: 4px; max-height: calc(100dvh - 224px); overflow-y: auto; z-index: 60; }
  #hud.mobile-nav-open #menubar { display: grid; }
  #menubar button { width: 46px; height: 44px; font-size: 16px; }
  #menubar button span { display: block; font-size: 8px; }
  .mobile-only { display: flex !important; }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 560px) {
  #hud-player { top: 6px; left: 6px; width: 190px; gap: 5px; padding: 5px; }
  #hud-avatar { width: 42px; height: 42px; }
  #minimap-box { top: 6px; right: 6px; width: 118px; padding: 4px; }
  #minimap { width: 108px; height: 108px; }
  .mm-head { font-size: 10px; margin-bottom: 2px; }
  #mobile-menu-toggle { top: 174px; right: 8px; }
  #menubar { top: 220px; right: 8px; max-height: calc(100dvh - 230px); }
  #gift-btn, #quest-tracker { display: none; }
  #buff-bar { top: 68px; left: 8px; }
  #target-frame { top: 6px; width: 190px; }
  #war-bar { top: 48px; }
  #skillbar { bottom: 20px; gap: 2px; padding: 3px; border-radius: 8px; }
  .sk { width: 34px; height: 38px; border-radius: 6px; }
  .sk .ico { font-size: 17px; }
  .sk.pot img { width: 24px; height: 24px; }
  #expbar { bottom: 2px; height: 12px; }
  #exptxt { line-height: 11px; font-size: 9px; }
  #joystick { left: 10px; bottom: 48px; width: 86px; height: 86px; }
  #joy-knob { left: 26px; top: 26px; width: 34px; height: 34px; }
  #mobile-actions { right: 8px; bottom: 48px; flex-direction: row; align-items: flex-end; gap: 5px; }
  #mobile-actions button { width: 48px; height: 48px; font-size: 20px; }
  #mobile-actions button + button { width: 38px; height: 38px; font-size: 16px; align-self: flex-end; }
  #chat { left: 106px; bottom: 70px; width: min(220px, 28vw); }
  #chat-open-btn { left: 106px; bottom: 70px; }
  #panels .panel { left: 4vw !important; top: 6px !important; max-height: calc(100dvh - 12px); }
  .panel-body { padding: 8px; }
  #npc-dialog { bottom: 54px; max-height: 48vh; }
  #loot-feed { bottom: 108px; right: 8px; }
}

/* ==========================================================================
   PREMIUM SYSTEMS STYLING (Trade, Market, Codex, Tower, Crafting, DPS Meter)
   ========================================================================== */

/* --- Trade Modal --- */
.trade-modal-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.trade-side { background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.trade-side-title { font-size: 13px; font-weight: 600; color: #facc15; border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 4px; }
.trade-gold-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.trade-gold-row input { width: 110px; padding: 3px 6px; font-size: 12px; background: rgba(0,0,0,0.5); border: 1px solid #eab308; border-radius: 4px; color: #fde047; text-align: right; }
.trade-quick-gold { display: flex; gap: 4px; margin-top: -2px; margin-bottom: 4px; flex-wrap: wrap; }
.trade-quick-gold button { padding: 2px 6px; font-size: 10px; }
.target-player { cursor: pointer; transition: color 0.15s ease, text-shadow 0.15s ease; }
.target-player:hover { color: #fde047; text-shadow: 0 0 8px rgba(250, 204, 21, 0.6); text-decoration: underline dotted; }
.clickable-player { cursor: pointer; transition: color 0.15s; }
.clickable-player:hover { color: #fde047; text-decoration: underline; }
.trade-slots-title { font-size: 11px; color: var(--dim); }
.trade-slots-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.trade-offer-cell { display: grid; justify-items: center; align-content: start; gap: 3px; min-width: 0; }
.trade-qty { width: 46px; padding: 2px 3px !important; text-align: center; font-size: 11px !important; }
.trade-status-badge { font-size: 11px; font-weight: 600; text-align: center; padding: 4px 8px; border-radius: 4px; margin-top: auto; }
.badge-waiting { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid #f59e0b; }
.badge-locked { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid #3b82f6; }
.badge-confirmed { background: rgba(34, 197, 94, 0.2); color: #4ade80; border: 1px solid #22c55e; }
.trade-actions-bar { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 8px; }

/* --- Marketplace --- */
.market-tabs { margin-bottom: 10px; display: flex; align-items: center; }
.market-search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.market-search-bar input { flex: 1; padding: 6px 10px; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; color: #fff; font-size: 13px; }
.market-items-grid { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.market-card { display: flex; align-items: center; justify-content: space-between; background: rgba(30, 41, 59, 0.5); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 8px 12px; }
.market-card:hover { border-color: rgba(250, 204, 21, 0.35); background: rgba(30, 41, 59, 0.75); }
.mc-left { display: flex; align-items: center; gap: 10px; }
.mc-title { font-weight: 600; font-size: 13px; }
.mc-right { display: flex; align-items: center; gap: 12px; }
.mc-price { font-size: 13px; }
.market-sell-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sell-slot-preview { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 8px; background: rgba(0,0,0,0.3); border-radius: 6px; }
.sell-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; margin-bottom: 10px; color: #e2e8f0; }
.sell-field input { padding: 6px 8px; font-size: 13px; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.2); border-radius: 4px; color: #fde047; }
.sell-tax-calc { margin-bottom: 12px; line-height: 1.5; }

/* --- Monster Codex --- */
.codex-header-card { background: linear-gradient(135deg, rgba(30, 27, 75, 0.7), rgba(59, 7, 100, 0.6)); border: 1px solid rgba(168, 85, 247, 0.3); border-radius: 8px; padding: 12px; margin-bottom: 14px; }
.ch-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ch-title { font-size: 15px; font-weight: 700; color: #fde047; }
.ch-title-picker select { background: rgba(0,0,0,0.6); color: #fde047; border: 1px solid #a855f7; border-radius: 4px; padding: 3px 6px; font-size: 12px; }
.codex-stats-box { background: rgba(0,0,0,0.35); border-radius: 6px; padding: 8px 10px; }
.csb-title { font-size: 11px; color: #c084fc; margin-bottom: 6px; font-weight: 600; }
.csb-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 10px; font-size: 12px; }
.csb-grid b { color: #4ade80; }
.codex-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.codex-card-item { background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.codex-card-item.codex-unlocked { border-color: rgba(250, 204, 21, 0.6); background: rgba(58, 45, 10, 0.35); box-shadow: 0 0 10px rgba(250, 204, 21, 0.1); }
.codex-card-item.codex-ready { border-color: rgba(52, 211, 153, 0.6); background: rgba(6, 78, 59, 0.25); }
.codex-card-item.codex-locked { opacity: 0.55; }
.cci-top { display: flex; align-items: center; gap: 8px; }
.cci-icon { font-size: 24px; }
.cci-name { font-weight: 600; font-size: 13px; color: #f1f5f9; }
.cci-stats { font-size: 11.5px; color: #38bdf8; }
.badge-registered { font-size: 10px; background: rgba(34, 197, 94, 0.2); color: #4ade80; border: 1px solid #22c55e; border-radius: 3px; padding: 2px 4px; margin-left: auto; }

/* --- Tower of Trials --- */
.tower-header-card { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, rgba(69, 10, 10, 0.6), rgba(88, 28, 135, 0.6)); border: 1px solid rgba(239, 68, 68, 0.3); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.th-title { font-size: 15px; font-weight: 700; color: #f87171; }
.th-status { font-size: 13px; }
.tower-floors-list { display: flex; flex-direction: column; gap: 8px; max-height: 440px; overflow-y: auto; padding-right: 4px; }
.tower-floor-card { display: flex; align-items: center; justify-content: space-between; background: rgba(30, 41, 59, 0.5); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 10px 14px; }
.tower-floor-card.tf-cleared { border-color: rgba(34, 197, 94, 0.3); background: rgba(6, 78, 59, 0.15); }
.tower-floor-card.tf-active { border-color: #facc15; background: rgba(113, 63, 18, 0.25); box-shadow: 0 0 12px rgba(250, 204, 21, 0.15); }
.tower-floor-card.tf-locked { opacity: 0.5; }
.tf-left { display: flex; align-items: center; gap: 14px; }
.tf-num { font-size: 14px; font-weight: 700; color: #fde047; min-width: 60px; }
.tf-mobs { font-size: 13px; }
.tf-rewards { font-size: 11.5px; color: #a5f3fc; margin-top: 2px; }
.tf-rewards .dia { color: #f472b6; font-weight: 600; }
.badge-cleared { font-size: 11px; font-weight: 600; color: #4ade80; background: rgba(34, 197, 94, 0.15); padding: 4px 8px; border-radius: 4px; border: 1px solid #22c55e; }

/* --- Crafting in Smith --- */
.smith-tabs { margin-bottom: 12px; }
.craft-recipes-grid { display: flex; flex-direction: column; gap: 10px; max-height: 440px; overflow-y: auto; padding-right: 4px; }
.craft-recipe-card { background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.craft-recipe-card:hover { border-color: rgba(250, 204, 21, 0.4); }
.crc-head { display: flex; align-items: center; gap: 12px; }
.crc-title { font-weight: 700; font-size: 14px; }
.crc-mats-title { font-size: 11px; color: var(--dim); }
.crc-mats-list { display: flex; flex-wrap: wrap; gap: 8px; }
.mat-chip { display: flex; align-items: center; gap: 5px; background: rgba(0,0,0,0.4); border-radius: 4px; padding: 3px 8px; font-size: 11.5px; border: 1px solid rgba(255,255,255,0.1); }
.mat-chip.mat-ok { border-color: #22c55e; color: #86efac; }
.mat-chip.mat-bad { border-color: #ef4444; color: #fca5a5; }
.crc-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(255,255,255,0.06); padding-top: 6px; }

/* --- Party DPS Meter --- */
.pf-dps-btn { font-size: 10px; padding: 1px 5px; margin-left: auto; border: 1px solid rgba(255,255,255,0.2); }
.dps-meter-wrap { margin-top: 6px; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 6px; }
.dps-meter-head { font-size: 11px; font-weight: 600; color: #fde047; margin-bottom: 4px; }
.dps-meter-list { display: flex; flex-direction: column; gap: 4px; }
.dps-meter-row { display: flex; flex-direction: column; gap: 2px; }
.dmr-info { display: flex; justify-content: space-between; font-size: 11px; }
.dmr-bar { height: 4px; width: 100%; background: rgba(0,0,0,0.5); border-radius: 2px; overflow: hidden; }
.dmr-bar div { height: 100%; background: linear-gradient(90deg, #ef4444, #f59e0b); border-radius: 2px; transition: width 0.25s ease; }

.btn { background: linear-gradient(#43584a, #2b3a30); border-color: #708575; }
.btn:hover { filter: brightness(1.16); border-color: #b3c9a9; }
.btn-gold { background: linear-gradient(#f4d783, #ca8b47); color: #241b0e; border-color: #ffe8a6; }
.btn-danger { background: linear-gradient(#aa463c, #762f2a); border-color: #ec887a; }
input:not([type=checkbox]):not([type=range]), select { background: #17221c; border-color: #52675a; }
.card { background: var(--panel); border-color: var(--line); border-radius: 8px; }
.tab { background: #202e25; border-color: var(--line); }
.tab.active { background: linear-gradient(#55705a, #344b3c); border-color: #9fbe91; }
.chip { background: #202e25; border-color: var(--line); }
.chip.active { background: var(--gold); color: #241b0e; border-color: #ffe8a6; }
.hud-box, #chat, #quest-tracker, #skillbar, #menubar { background-color: rgba(19, 29, 24, 0.94); border-color: var(--line); }
#hud-avatar { background: radial-gradient(circle, #526c50, #18231c); border-color: var(--gold2); }
.bar { background: #101813; border-color: #34473a; }
.bar.hp > div { background: linear-gradient(#ff9380, #d64d47); }
.bar.mp > div { background: linear-gradient(#75d5dc, #228995); }
.bar.exp > div, #expfill { background: linear-gradient(90deg, #52966b, #a5d78e); }
#skillbar { border-radius: 8px; }
.sk { background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c, #718575) 42%, #25352a), #131d17); }
#menubar button { background: #202e25; border-color: #405748; }
#menubar button:hover { background: #344c3b; border-color: var(--gold2); }
#panels .panel { background: var(--panel); border-color: #708575; border-radius: 8px; }
.panel-head { background: linear-gradient(#405941, #26372d); color: #f5d783; border-radius: 8px 8px 0 0; }
.panel-x { background: #34483a; border-color: #708575; }
.char-slot, .class-card, .wm-row, .craft-recipe-card, .market-card, .tower-floor-card, .trade-side, .codex-card-item { background-color: rgba(31, 45, 36, 0.82); border-color: rgba(151, 178, 145, 0.28); }
.char-slot:hover, .craft-recipe-card:hover, .market-card:hover { border-color: var(--gold2); }
.wm-row.here { border-color: var(--gold); }
.bag-actions { display: flex; justify-content: flex-end; gap: 6px; margin: 0 0 8px; }
.skill-progress { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; padding: 9px 10px; background: rgba(84, 126, 87, 0.18); border: 1px solid rgba(148, 188, 132, 0.42); border-radius: 6px; }
.skill-progress b { color: #f1d486; text-align: right; }
.mat-chip.mat-ok { border-color: #73b77b; color: #a8dfa0; }
.mat-chip.mat-bad { border-color: #d56f64; color: #ffaaa0; }
.trade-side-title, .ch-title, .dps-meter-head { color: #f1d486; }
.codex-header-card, .tower-header-card { background: linear-gradient(135deg, rgba(49, 74, 51, 0.78), rgba(32, 48, 42, 0.88)); border-color: rgba(172, 194, 126, 0.4); }
.th-title { color: #f18b74; }
.tower-floor-card.tf-active { border-color: var(--gold); background: rgba(119, 83, 31, 0.24); }
.badge-confirmed, .badge-cleared { border-color: #73b77b; color: #a8dfa0; }
.skill-row { border-color: rgba(151, 178, 145, 0.28); }
.toast { border-color: var(--line); border-left-color: #9fbe91; }
.mm-btn { background: #34483a; border-color: #708575; }
.create-preview { background: radial-gradient(circle at 50% 40%, #344b3c, #17221c 72%); }

@media (max-width: 540px) {
  .bag-actions { justify-content: stretch; }
  .bag-actions .btn { flex: 1; }
  .skill-progress { align-items: flex-start; flex-direction: column; }
  .skill-progress b { text-align: left; }
}

.premium-banner { display: flex; flex-direction: column; gap: 5px; padding: 12px; background: linear-gradient(120deg, rgba(77, 112, 68, 0.36), rgba(43, 69, 52, 0.55)); border: 1px solid rgba(196, 177, 105, 0.65); border-radius: 7px; }
.premium-banner-title { color: #f4d783; font-family: 'Kanit'; font-weight: 700; font-size: 17px; }
.premium-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.premium-plan { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 12px; background: rgba(31, 45, 36, 0.82); border: 1px solid rgba(151, 178, 145, 0.35); border-radius: 7px; overflow: hidden; }
.premium-plan-ribbon { align-self: flex-start; padding: 2px 7px; color: #2c2614; background: #f1c96f; border-radius: 3px; font-size: 11px; font-weight: 700; }
.premium-price { color: #f4d783; font-size: 17px; font-weight: 700; }
.premium-price small { color: var(--dim); font-size: 11px; font-weight: 400; text-decoration: line-through; }
.premium-switches { display: grid; gap: 6px; }
.premium-feature { display: flex; align-items: flex-start; gap: 10px; padding: 10px; background: rgba(31, 45, 36, 0.62); border: 1px solid rgba(151, 178, 145, 0.25); border-radius: 6px; }
.premium-feature input { margin: 3px 0 0; accent-color: #96bf82; }
.premium-feature span { display: grid; gap: 3px; }
.premium-feature small { color: var(--dim); line-height: 1.4; }
.wm-travel { display: block; margin-top: 6px; }
.install-prompt { display: grid; justify-items: center; gap: 5px; width: min(380px, 94vw); }
.install-hint { color: var(--dim); font-size: 12px; line-height: 1.45; text-align: center; }
.gm-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--gold); }
.gm-layout { display: grid; grid-template-columns: minmax(170px, 0.8fr) minmax(260px, 1.2fr); gap: 10px; min-height: 220px; }
.gm-roster { display: flex; flex-direction: column; gap: 4px; max-height: 340px; overflow-y: auto; }
.gm-player { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 8px; color: var(--text); background: rgba(31, 45, 36, 0.7); border: 1px solid rgba(151, 178, 145, 0.25); border-radius: 6px; text-align: left; cursor: pointer; }
.gm-player.active { border-color: var(--gold); background: rgba(97, 83, 42, 0.3); }
.gm-player-name { font-weight: 700; }
.gm-controls { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: rgba(31, 45, 36, 0.5); border: 1px solid rgba(151, 178, 145, 0.25); border-radius: 6px; }
.gm-target, .gm-field { display: grid; gap: 5px; }
.gm-inline { display: flex; align-items: center; gap: 6px; }
.gm-inline input, .gm-inline select { flex: 1; min-width: 0; }
.gm-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.gm-announcement { display: grid; gap: 6px; margin-top: 10px; }
@media (max-width: 480px) { .premium-plans { grid-template-columns: 1fr; } }
@media (max-width: 540px) { .gm-layout { grid-template-columns: 1fr; } .gm-roster { max-height: 180px; } }

/* ==========================================================================
   v2.1 — Combat Power, Starfall event, quest categories, mounts, bot settings
   ========================================================================== */
/* Combat Power badge & change banner */
.hud-cp { position: absolute; top: -11px; right: 8px; display: flex; align-items: baseline; gap: 5px; padding: 2px 10px 3px; border-radius: 999px; background: linear-gradient(135deg, #1c1305, #4a3208 45%, #1c1305); border: 1px solid #f1c96f; box-shadow: 0 0 12px rgba(241, 201, 111, .35), inset 0 1px 0 rgba(255,255,255,.2); font-family: 'Lilita One', 'Kanit', sans-serif; letter-spacing: .5px; pointer-events: none; }
.hud-cp .cp-label { font-size: 10px; color: #f1c96f; }
.hud-cp #hud-cp-txt { font-size: 14px; background: linear-gradient(#fffbeb, #fcd34d 55%, #f59e0b); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 1px 0 #3b2106); }
.cp-pop { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 8px 22px; border-radius: 12px; background: linear-gradient(90deg, rgba(20,14,4,0), rgba(20,14,4,.88) 18%, rgba(20,14,4,.88) 82%, rgba(20,14,4,0)); pointer-events: none; transition: opacity .6s, transform .6s; animation: cpIn .45s cubic-bezier(.2, 1.6, .4, 1); z-index: 40; }
.cp-pop.out { opacity: 0; transform: translate(-50%, -12px); animation: none; }
@keyframes cpIn { from { transform: translate(-50%, 18px) scale(.7); opacity: 0; } }
.cp-pop-label { font-family: 'Kanit'; font-weight: 700; color: #f1c96f; font-size: 14px; }
.cp-pop-num { font-family: 'Lilita One', 'Kanit', sans-serif; font-size: 30px; background: linear-gradient(#ffffff, #fde047 55%, #f59e0b); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 #3b2106) drop-shadow(0 0 10px rgba(253,224,71,.45)); min-width: 110px; text-align: center; }
.cp-pop-diff { font-family: 'Lilita One', 'Kanit', sans-serif; font-size: 20px; }
.cp-pop.up .cp-pop-diff { color: #4ade80; text-shadow: 0 0 10px rgba(74,222,128,.6); }
.cp-pop.down .cp-pop-diff { color: #f87171; }
.cp-card { display: inline-flex; align-items: baseline; gap: 8px; margin: 5px 0 3px; padding: 3px 12px; border-radius: 8px; background: linear-gradient(135deg, #1c1305, #4a3208); border: 1px solid #b98a2e; }
.cp-card-label { font-size: 12px; color: #f1c96f; font-weight: 700; }
.cp-card-num { font-family: 'Lilita One', 'Kanit', sans-serif; font-size: 20px; background: linear-gradient(#fffbeb, #fcd34d 55%, #f59e0b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.insp-stats { margin: 8px 0; }
.insp-mount { display: flex; gap: 10px; align-items: center; background: rgba(31,45,36,.6); border: 1px solid rgba(151,178,145,.28); border-radius: 8px; padding: 4px 10px; }
.insp-mount img { width: 80px; height: 64px; image-rendering: pixelated; }

/* Starfall event banner */
#event-banner { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 12px; border: 1px solid #a78bfa; background: linear-gradient(90deg, rgba(46,16,101,.94), rgba(30,27,75,.94)); color: #ede9fe; cursor: pointer; box-shadow: 0 0 18px rgba(167,139,250,.45); animation: evGlow 2.2s infinite; font-family: inherit; }
#event-banner.here { cursor: default; border-color: #fde68a; }
#event-banner .eb-ico { font-size: 22px; }
#event-banner .eb-main { display: flex; flex-direction: column; text-align: left; font-size: 13px; }
#event-banner .eb-main small { color: #c4b5fd; font-size: 11px; }
#event-banner .eb-time { font-family: 'Lilita One', 'Kanit', sans-serif; font-size: 18px; color: #fde68a; }
@keyframes evGlow { 50% { box-shadow: 0 0 28px rgba(253,230,138,.55); } }
#war-bar:not(.hidden) ~ #event-banner { top: 100px; }

/* Skill & buff icons */
.sk .ico-img { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); border-radius: 7px; pointer-events: none; }
.sk.locked .ico-img { filter: grayscale(1) brightness(.6); }
.buff { overflow: hidden; padding: 0; }
.buff img { width: 100%; height: 100%; border-radius: 6px; }
.skill-ico img { width: 44px; height: 44px; border-radius: 9px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
/* v3.16 — skill tiers and the effect preview button */
.skill-row { position: relative; align-items: flex-start; background: linear-gradient(100deg, color-mix(in srgb, var(--c) 14%, #16132f) 0%, #16132f 46%); }
.skill-ico { width: 64px; flex: none; display: grid; justify-items: center; gap: 5px; }
.skill-ico img { width: 56px; height: 56px; border-radius: 11px; }
.skill-fx { font: inherit; font-size: 10.5px; line-height: 1; padding: 4px 5px; border-radius: 999px; cursor: pointer; white-space: nowrap; color: #e0e7ff; background: rgba(99, 102, 241, .22); border: 1px solid rgba(165, 180, 252, .5); }
.skill-fx:hover { background: rgba(129, 140, 248, .45); color: #fff; }
.skill-row.locked { opacity: 1; }
.skill-row.locked .skill-ico img, .skill-row.locked .skill-info { opacity: .55; }
.tier-chip { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 999px; vertical-align: 1px; letter-spacing: .02em; color: #cbd5e1; background: rgba(148, 163, 184, .18); border: 1px solid rgba(148, 163, 184, .4); }
.tier-chip.t1 { color: #e2e8f0; background: rgba(226, 232, 240, .14); border-color: rgba(226, 232, 240, .55); }
.tier-chip.t2 { color: #f5d0fe; background: linear-gradient(90deg, rgba(129, 140, 248, .35), rgba(103, 232, 249, .3)); border-color: #a5b4fc; }
.tier-chip.t3 { color: #422006; background: linear-gradient(180deg, #fff7cc, #fbbf24); border-color: #fde68a; box-shadow: 0 0 8px rgba(251, 191, 36, .6); }
.skill-row.tier2 { border-color: rgba(165, 180, 252, .6); box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .18); }
.skill-row.tier3 { border-color: rgba(251, 191, 36, .75); box-shadow: inset 0 0 18px rgba(251, 191, 36, .1), 0 0 12px rgba(251, 191, 36, .16); overflow: hidden; }
.skill-row.tier3::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 38%, rgba(255, 247, 204, .2) 50%, transparent 62%); background-size: 260% 100%; animation: skShine 3.2s linear infinite; }
@keyframes skShine { from { background-position: 130% 0; } to { background-position: -130% 0; } }
@media (prefers-reduced-motion: reduce) { .skill-row.tier3::after { animation: none; } }
.tt-skill img { width: 22px; height: 22px; vertical-align: -5px; border-radius: 5px; }

/* Bot panel on HUD */
.bot-btn-row { display: flex; gap: 4px; }
.bot-btn-row .btn-bot { flex: 1; }
.bot-cfg { width: 32px; flex: 0 0 32px; border-radius: 8px; border: 1px solid #4b5563; background: #1c1840; color: #fff; cursor: pointer; font-size: 14px; padding: 0; }
.bot-cfg:hover { border-color: var(--gold2); filter: brightness(1.2); }

/* Player context menu */
.ctx-head { display: flex; align-items: center; gap: 8px; }
.ctx-avatar { width: 40px; height: 40px; border-radius: 8px; background: radial-gradient(circle, #526c50, #18231c); border: 1px solid var(--gold2); flex-shrink: 0; }
.ctx-name { font-family: 'Kanit'; font-size: 14px; }

/* Quest categories */
.qcat-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.qcat-tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 4px; border-radius: 10px; border: 1px solid var(--line); background: #202e25; color: var(--dim); cursor: pointer; font-weight: 700; font-size: 12.5px; }
.qcat-tab .qcat-ico { font-size: 20px; }
.qcat-tab.active { color: #fff; background: linear-gradient(#55705a, #344b3c); border-color: #f1c96f; box-shadow: 0 0 12px rgba(241,201,111,.25); }
.qcat-badge { position: absolute; top: -6px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #ef4444; color: #fff; font-style: normal; font-size: 11px; line-height: 18px; box-shadow: 0 0 8px rgba(239,68,68,.6); }
.qt-cat { display: inline-block; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 4px; margin-right: 2px; vertical-align: 1px; }
.qt-cat.qc-main { background: #854d0e; color: #fef3c7; }
.qt-cat.qc-town { background: #1e40af; color: #dbeafe; }
.qt-cat.qc-daily { background: #0e7490; color: #cffafe; }
.qt-cat.qc-field { background: #3f6212; color: #ecfccb; }
.daily-head { display: grid; gap: 6px; padding: 10px 12px; margin-bottom: 8px; border-radius: 10px; background: linear-gradient(120deg, rgba(14,116,144,.35), rgba(31,45,36,.8)); border: 1px solid rgba(103,232,249,.35); }
.dh-top { display: flex; justify-content: space-between; align-items: center; }
.dh-progress { display: flex; gap: 8px; align-items: center; }
.dh-bar { flex: 1; height: 10px; border-radius: 6px; background: #0b1416; border: 1px solid #155e75; overflow: hidden; }
.dh-bar > div { height: 100%; background: linear-gradient(90deg, #06b6d4, #67e8f9); transition: width .3s; }
.dh-reward { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dh-reward img { width: 30px; height: 30px; }
.dh-reward .btn, .dh-reward .ok, .dh-reward .dim { margin-left: auto; }
.daily-strip { width: 100%; font-size: 12.5px; padding: 6px 10px; border-radius: 8px; background: rgba(14,116,144,.25); border: 1px solid rgba(103,232,249,.3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rw.mount-rw img { width: 28px; height: 22px; image-rendering: pixelated; }
.npc-q .qt-cat { font-size: 9.5px; }

/* Mounts */
.mount-head { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 10px; background: radial-gradient(circle at 15% 50%, rgba(241,201,111,.18), rgba(31,45,36,.85) 60%); border: 1px solid rgba(241,201,111,.4); margin-bottom: 10px; flex-wrap: wrap; }
.mount-hero { width: 160px; height: 128px; image-rendering: pixelated; background: radial-gradient(circle, #3a5440, #16211a 70%); border-radius: 10px; border: 1px solid var(--line); }
.mount-hero.empty { display: flex; align-items: center; justify-content: center; font-size: 48px; opacity: .5; }
.mh-info { flex: 1; min-width: 180px; display: grid; gap: 6px; align-content: start; }
.mh-title { font-family: 'Kanit'; font-size: 19px; font-weight: 700; color: #fde68a; }
.mh-info .btn { justify-self: start; }
.mh-wallet { display: grid; gap: 3px; font-size: 12px; font-weight: 700; color: #fde68a; }
.mount-note { font-size: 12px; padding: 6px 10px; border-radius: 8px; background: rgba(120,83,31,.25); border: 1px dashed rgba(241,201,111,.45); margin-bottom: 10px; }
.mount-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.mount-card { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 10px; background: rgba(31,45,36,.82); border: 1px solid rgba(151,178,145,.28); }
.mount-card.owned { border-color: rgba(115,183,123,.6); }
.mount-card.active { border-color: #f1c96f; box-shadow: 0 0 14px rgba(241,201,111,.25); }
.mc-art { position: relative; height: 96px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: radial-gradient(circle at 50% 70%, #3a5440, #16211a 75%); }
.mc-art img { width: 120px; height: 96px; image-rendering: pixelated; }
.mc-fly { position: absolute; top: 4px; right: 6px; font-size: 10px; font-weight: 700; color: #7dd3fc; }
.mc-name { font-family: 'Kanit'; font-weight: 700; color: #f5f5f4; }
.mc-speed { font-size: 12px; color: #86efac; font-weight: 700; }
.mc-stats { font-size: 11.5px; color: #a5f3fc; }
.mc-desc { line-height: 1.35; }
.mc-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: auto; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.06); }
.mc-price { font-weight: 700; color: #fde68a; font-size: 12.5px; }
.mc-active { color: #fde68a; font-weight: 700; font-size: 12px; }

/* Bot settings panel */
.bot-hero { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; background: rgba(31,45,36,.85); border: 1px solid var(--line); }
.bot-hero.on { border-color: #34d399; background: linear-gradient(120deg, rgba(5,150,105,.3), rgba(31,45,36,.85)); }
.bot-hero-ico { font-size: 30px; }
.bot-hero-main { flex: 1; display: grid; min-width: 0; }
.bot-hero-main small { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bot-sec { display: grid; gap: 6px; align-content: start; padding: 10px; border-radius: 10px; background: rgba(31,45,36,.6); border: 1px solid rgba(151,178,145,.25); }
.bot-sec-title { font-family: 'Kanit'; font-weight: 700; color: #f1d486; font-size: 14px; }
.bot-row { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.bot-row-txt { display: grid; }
.bot-row-txt small { color: var(--dim); font-size: 11px; }
.sw { position: relative; width: 34px; height: 19px; flex: 0 0 34px; }
.sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.sw i { position: absolute; inset: 0; border-radius: 999px; background: #3a4a40; border: 1px solid #5d7263; transition: background .2s; pointer-events: none; }
.sw i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #d6d3d1; transition: transform .2s; }
.sw input:checked + i { background: linear-gradient(90deg, #059669, #34d399); border-color: #a7f3d0; }
.sw input:checked + i::after { transform: translateX(15px); background: #fff; }
.bot-slider { display: flex; align-items: center; gap: 8px; padding-left: 42px; }
.bot-slider input { flex: 1; accent-color: #f1c96f; }
.bot-slider b { min-width: 58px; text-align: right; color: #fde68a; font-size: 13px; }
.bot-note { font-size: 11.5px; color: var(--dim); }
.bot-park { display: flex; align-items: center; gap: 8px; margin: -4px 0 10px; padding: 7px 10px; border-radius: 9px; font-size: 12px; line-height: 1.45; color: #fde68a; background: rgba(120, 83, 12, .28); border: 1px solid rgba(251, 191, 36, .45); }
.bot-park span { flex: 1; min-width: 0; }
.bot-park .btn { flex: none; white-space: nowrap; }
.bot-inline { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.bot-inline input { width: 80px; padding: 4px 6px !important; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg label { cursor: pointer; }
.seg input { display: none; }
.seg span { display: block; text-align: center; padding: 5px; font-size: 12.5px; font-weight: 700; color: var(--dim); background: #202e25; }
.seg input:checked + span { background: linear-gradient(#55705a, #344b3c); color: #fff; }
.bot-mobs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; max-height: 190px; overflow-y: auto; }
.bot-mobs.off { opacity: .45; pointer-events: none; }
.bot-mob { display: flex; align-items: center; gap: 5px; padding: 3px 5px; border-radius: 7px; border: 1px solid rgba(151,178,145,.25); background: rgba(19,29,24,.7); cursor: pointer; font-size: 12px; }
.bot-mob.on { border-color: #f1c96f; background: rgba(120,83,31,.35); }
.bot-mob input { accent-color: #f1c96f; margin: 0; }
.bot-mob img { width: 26px; height: 26px; image-rendering: pixelated; }
.bot-mob span { display: grid; line-height: 1.15; }
.bot-mob small { color: var(--dim); font-size: 10.5px; }
.bot-mob-actions { grid-column: 1 / -1; display: flex; gap: 6px; }
.bot-anchor { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.bot-anchor .btn { margin-left: auto; }
.bot-skills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.bot-skill { display: grid; justify-items: center; gap: 2px; padding: 4px 2px; border-radius: 8px; border: 1px solid #f1c96f; background: rgba(19,29,24,.7); color: var(--text); cursor: pointer; font-size: 10px; font-family: inherit; }
.bot-skill img { width: 34px; height: 34px; border-radius: 7px; }
.bot-skill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bot-skill.off { border-color: var(--line); opacity: .45; }
.bot-skill.off img { filter: grayscale(1); }
.bot-skill.lock { opacity: .3; }
@media (max-width: 640px) { .bot-grid { grid-template-columns: 1fr; } .qcat-tabs { grid-template-columns: repeat(2, 1fr); } }
#mobile-actions #mob-ride { background: rgba(146,64,14,.75); border-color: #fcd34d; }
@media (max-width: 900px) { #event-banner { top: 112px; padding: 4px 10px; max-width: 94vw; } #event-banner .eb-main small { display: none; } .cp-pop { bottom: 200px; } }

/* ================= v2.2 — quick-slot bar, badges, channels, news, cursors ================= */
:root {
  --cur-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' shape-rendering='crispEdges'><polygon points='1,1 1,17 5,13 8,20 11,19 8,12 14,12' fill='%23fde68a' stroke='%233b1d05' stroke-width='1.5'/><polygon points='3,5 3,12 6,9' fill='%23fff7cc'/></svg>") 1 1;
  --cur-attack: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' shape-rendering='crispEdges'><polygon points='1,1 5,1 16,12 12,16 1,5' fill='%23e5e7eb' stroke='%231e293b' stroke-width='1.2'/><line x1='3' y1='3' x2='13' y2='13' stroke='%23ffffff' stroke-width='1'/><line x1='10' y1='18' x2='18' y2='10' stroke='%23b45309' stroke-width='3'/><line x1='15' y1='15' x2='20' y2='20' stroke='%2378350f' stroke-width='3'/><circle cx='21' cy='21' r='2' fill='%23fbbf24' stroke='%233b1d05'/></svg>") 1 1;
  --cur-talk: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' shape-rendering='crispEdges'><rect x='2' y='2' width='19' height='13' rx='4' fill='%23ffffff' stroke='%231e293b' stroke-width='1.5'/><polygon points='6,14 5,21 12,14' fill='%23ffffff' stroke='%231e293b' stroke-width='1.2'/><rect x='6' y='8' width='2' height='2' fill='%231e293b'/><rect x='10.5' y='8' width='2' height='2' fill='%231e293b'/><rect x='15' y='8' width='2' height='2' fill='%231e293b'/></svg>") 3 3;
}
body, #game { cursor: var(--cur-arrow), default; }
#game[data-cur=attack] { cursor: var(--cur-attack), crosshair; }
#game[data-cur=talk] { cursor: var(--cur-talk), pointer; }
#game[data-cur=pick] { cursor: var(--cur-talk), pointer; }

/* quick-slot bar (Shift+1..8) */
#quickbar { position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: rgba(19, 29, 24, 0.82); border: 1px solid var(--line); z-index: 4; }
#quickbar:empty { display: none; }
.qs { width: 38px; height: 38px; border-radius: 7px; border: 1px solid #5d7563; background: radial-gradient(circle at 50% 35%, #2c3e31, #121b15); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.qs:hover { border-color: var(--gold2); filter: brightness(1.2); }
.qs.empty { border-style: dashed; opacity: .55; }
.qs.none img { filter: grayscale(1); opacity: .45; }
.qs img { width: 28px; height: 28px; image-rendering: pixelated; pointer-events: none; }
.qs .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.7); pointer-events: none; }
.qs .cnt { position: absolute; bottom: 0; right: 2px; font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000; pointer-events: none; }
.qs .key { position: absolute; top: 0; left: 2px; font-size: 9px; font-weight: 700; color: #fde68a; text-shadow: 0 1px 2px #000; pointer-events: none; }

/* red notification badges on menu buttons */
#menubar button { position: relative; } /* (the mobile menu toggle is already absolutely positioned) */
.mb-badge { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: linear-gradient(#f43f5e, #be123c); color: #fff; font: 700 10px/17px 'Kanit', sans-serif; font-style: normal; text-align: center; box-shadow: 0 0 0 2px #1a120a, 0 0 8px rgba(244,63,94,.7); pointer-events: none; animation: badge-pop .35s ease-out; }
@keyframes badge-pop { from { transform: scale(.4); } 70% { transform: scale(1.2); } to { transform: scale(1); } }

/* channel picker on the minimap */
.mm-ch { flex: 0 0 auto; height: 22px; padding: 0 7px; margin-left: auto; border-radius: 6px; border: 1px solid #c9a24b; background: linear-gradient(#4a3a14, #2b2109); color: #fde68a; font: 700 11px 'Kanit', sans-serif; cursor: pointer; }
.mm-ch:hover { filter: brightness(1.25); }
.mm-ch + .mm-btn { margin-left: 2px; }
#ch-menu { position: absolute; top: 34px; right: 6px; width: 200px; z-index: 50; background: rgba(15, 22, 18, .97); border: 1px solid var(--gold2, #c9a24b); border-radius: 10px; padding: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.6); }
.chm-title { font-weight: 700; color: #fde68a; font-size: 12px; margin-bottom: 6px; }
.chm-row { width: 100%; display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; padding: 6px 8px; margin-bottom: 4px; border-radius: 8px; border: 1px solid var(--line); background: #1c2a21; color: var(--text); cursor: pointer; font-family: inherit; }
.chm-row b { grid-row: span 2; color: #fde68a; }
.chm-row small { color: var(--dim); font-size: 10.5px; }
.chm-row:hover:not([disabled]) { border-color: var(--gold2, #c9a24b); background: #2a3b2f; }
.chm-row.cur { border-color: #4ade80; cursor: default; }
.chm-bar { height: 6px; border-radius: 3px; background: #0b120e; overflow: hidden; }
.chm-bar i { display: block; height: 100%; border-radius: 3px; background: #22c55e; }
.chm-bar.busy i { background: #f59e0b; }
.chm-bar.full i { background: #ef4444; }
.chm-hint { font-size: 10.5px; color: var(--dim); margin-top: 2px; }

/* training dummy DPS readout */
#target-extra { margin-top: 4px; font-size: 11.5px; color: #fde68a; line-height: 1.35; }
#target-extra b { color: #fff; font-size: 13px; }
/* the DPS line makes the target frame taller — keep the war bar / event banner clear of it */
#target-frame:not(.hidden):has(#target-extra:not(.hidden)) ~ #war-bar { top: 86px; }
#target-frame:not(.hidden):has(#target-extra:not(.hidden)) ~ #event-banner { top: 88px; }
#target-frame:not(.hidden):has(#target-extra:not(.hidden)) ~ #war-bar:not(.hidden) ~ #event-banner { top: 124px; }

/* patch notes (login card + in-game news panel) */
.news-card { width: min(380px, 94vw); padding: 12px 14px; max-height: 30vh; overflow-y: auto; }
.news-title { font-family: 'Kanit'; font-weight: 700; color: #fde68a; margin-bottom: 6px; }
.pn-entry { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; margin-bottom: 10px; }
.pn-entry.latest { border-left-color: #f1c96f; }
.pn-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.pn-head b { color: #fef3c7; }
.pn-head small { color: var(--dim); margin-left: auto; }
.pn-v { font: 700 10px 'Press Start 2P', monospace; color: #c4b5fd; }
.pn-entry ul { margin: 4px 0 0; padding-left: 16px; font-size: 12.5px; line-height: 1.55; }
.news-modal { width: min(560px, 94vw); }
.news-scroll { max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.wm-row .ok { color: #4ade80; }

/* ================= v2.3 — dodge, boss ranking, dungeons ================= */
.sk.dodge { --c: #0891b2; }
.sk.dodge .dodge-ico { font-size: 22px; }
#mobile-actions #mob-dodge { position: absolute; top: 7px; right: 72px; width: 50px; height: 50px; font-size: 20px; background: rgba(8,145,178,.78); border-color: #a5f3fc; }
@media (max-width: 900px) and (orientation: landscape) and (max-height: 560px) { #mobile-actions #mob-dodge { top: -44px; right: 0; width: 38px; height: 38px; font-size: 16px; } }

#dg-bar { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 5px 12px; border-radius: 10px; background: linear-gradient(90deg, rgba(49,46,129,.94), rgba(30,27,75,.94)); border: 1px solid #818cf8; color: #e0e7ff; font-size: 13px; white-space: nowrap; box-shadow: 0 0 16px rgba(129,140,248,.35); z-index: 6; }
#dg-bar small { color: #c7d2fe; }
.dgb-name { font-weight: 700; color: #fde68a; }
.dgb-time { font-variant-numeric: tabular-nums; font-weight: 700; }
.dgb-stars, .dg-st, .rc-stars { color: #fde047; letter-spacing: 1px; text-shadow: 0 0 8px rgba(253,224,71,.6); }
.dgb-stars.s1, .dg-st.s1, .rc-stars.s1 { color: #fdba74; }
#dg-bar:not(.hidden) ~ #event-banner { top: 100px; }

#boss-dmg { position: absolute; left: 10px; bottom: 236px; width: 230px; padding: 6px 8px; font-size: 12px; z-index: 6; }
.bd-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; color: #fecaca; }
.bd-ph { font-size: 10.5px; padding: 1px 6px; border-radius: 6px; background: #7f1d1d; color: #fff; }
.bd-list { margin: 4px 0 2px; }
.bd-row { position: relative; display: flex; justify-content: space-between; padding: 1px 4px; border-radius: 4px; overflow: hidden; }
.bd-row span, .bd-row b { position: relative; z-index: 1; }
.bd-row i { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(239,68,68,.22); }
.bd-row.me { background: rgba(250,204,21,.16); color: #fde68a; }

.result-card { position: fixed; top: 18%; left: 50%; transform: translateX(-50%); width: min(420px, 92vw); z-index: 11000; padding: 16px 18px; border-radius: 14px; text-align: center; background: linear-gradient(180deg, rgba(30,27,75,.97), rgba(15,23,42,.97)); border: 1px solid #fbbf24; box-shadow: 0 10px 40px rgba(0,0,0,.6), 0 0 30px rgba(251,191,36,.25); animation: rc-in .35s ease-out; }
.result-card.out { opacity: 0; transform: translateX(-50%) translateY(-10px); transition: all .35s; }
@keyframes rc-in { from { opacity: 0; transform: translateX(-50%) scale(.85); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
.rc-title { font-family: 'Kanit'; font-weight: 700; font-size: 18px; color: #fde68a; }
.rc-big { margin: 6px 0; font-size: 14px; }
.rc-stars { font-size: 40px; line-height: 1.1; margin: 4px 0; animation: rc-star 1.2s ease-out; }
@keyframes rc-star { 0% { transform: scale(2.2); opacity: 0; } 60% { transform: scale(.9); opacity: 1; } 100% { transform: scale(1); } }
.rc-ranks { display: grid; gap: 2px; margin: 8px auto; max-width: 280px; text-align: left; font-size: 12.5px; }
.rc-ranks div { display: flex; justify-content: space-between; }
.rc-rewards { margin-top: 8px; font-size: 12.5px; color: #e0e7ff; line-height: 1.5; }
.rc-x { position: absolute; top: 8px; right: 8px; }

.dg-card { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; padding: 10px; margin-bottom: 8px; border-radius: 10px; border: 1px solid var(--line); background: rgba(19,29,24,.7); }
.dg-card.lock { opacity: .55; }
.dg-ico { font-size: 32px; text-align: center; }
.dg-name { font-weight: 700; color: #fde68a; }
.dg-main .small { margin-top: 2px; line-height: 1.45; }
.dg-btns { display: flex; flex-direction: column; gap: 5px; align-items: stretch; }
@media (max-width: 640px) { .dg-card { grid-template-columns: 36px 1fr; } .dg-btns { grid-column: 1 / -1; flex-direction: row; } }
@media (max-width: 900px) {
  /* touch layouts: compact top-3 ranking under the top bars (the side columns are full) */
  #boss-dmg { left: 50%; bottom: auto; top: 150px; transform: translateX(-50%); width: 200px; font-size: 11px; padding: 4px 6px; }
  #boss-dmg .bd-list .bd-row:nth-child(n+4), #boss-dmg > .dim { display: none; }
  #dg-bar { top: 108px; font-size: 11.5px; gap: 6px; padding: 4px 8px; max-width: 96vw; }
  #dg-bar small { display: none; }
}
@media (max-height: 560px) { #boss-dmg { top: 118px; bottom: auto; } #boss-dmg .bd-list .bd-row:nth-child(n+4), #boss-dmg > .dim { display: none; } }

/* auto-reconnect */
.reconnect-spinner { width: 34px; height: 34px; margin: 6px auto 12px; border-radius: 50%; border: 4px solid rgba(253,230,138,.2); border-top-color: #fde68a; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  /* touch layouts: a 2×4 grid on the right edge, between the gift button and the touch action buttons
     (the bottom centre belongs to the chat, joystick and skill bar) */
  #quickbar { bottom: auto; top: 274px; left: auto; right: 6px; transform: none; display: grid; grid-template-columns: repeat(2, 30px); gap: 2px; padding: 2px; }
  .qs { width: 30px; height: 30px; }
  .qs img { width: 22px; height: 22px; }
  .qs .key { display: none; }
}
@media (max-width: 540px) {
  #quickbar { grid-template-columns: repeat(2, 26px); }
  .qs { width: 26px; height: 26px; }
  .qs img { width: 20px; height: 20px; }
}
@media (max-width: 900px) and (orientation: landscape) and (max-height: 560px) {
  /* landscape phones: 4×2 under the minimap, above the touch action buttons */
  #quickbar { top: 190px; bottom: auto; right: 6px; left: auto; transform: none; grid-template-columns: repeat(4, 26px); }
  .qs { width: 26px; height: 26px; }
}

/* ==========================================================================
   v2.3.1 — chat box & every notification sized for every screen
   ========================================================================== */
/* quick-sell panel */
.qs-note { font-size: 12px; color: var(--dim); line-height: 1.5; margin-bottom: 8px; }
.qs-note b { color: #fde68a; }
.qs-grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.qs-grade { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; border: 2px solid rgba(255,255,255,.12); background: rgba(15,22,18,.7); color: var(--dim); font: 600 12.5px 'Kanit', sans-serif; cursor: pointer; opacity: .6; }
.qs-grade i { width: 12px; height: 12px; border-radius: 3px; background: var(--gc); box-shadow: 0 0 6px var(--gc); flex: 0 0 auto; }
.qs-grade small { margin-left: auto; font-size: 11px; color: var(--dim); }
.qs-grade.on { opacity: 1; color: #fff; border-color: var(--gc); background: color-mix(in srgb, var(--gc) 16%, #131d17); }
.qs-mats { display: flex; align-items: center; gap: 6px; font-size: 12.5px; margin-bottom: 8px; }
.qs-preview { display: flex; flex-wrap: wrap; gap: 4px; min-height: 52px; max-height: 190px; overflow-y: auto; padding: 6px; border-radius: 8px; background: rgba(0,0,0,.25); border: 1px solid var(--line); }
.qs-preview .slot { width: 40px; height: 40px; cursor: default; }
.qs-preview .slot img { width: 30px; height: 30px; }
.qs-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap; }
.qs-foot .gold { color: #fde68a; }
@media (max-width: 420px) { .qs-grades { grid-template-columns: repeat(2, 1fr); } }

/* chat tabs never wrap: they scroll sideways instead */
.chat-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chat-tabs::-webkit-scrollbar { display: none; }
.chat-tabs button { white-space: nowrap; flex: 0 0 auto; }
.chat-actions { position: sticky; right: 0; padding-left: 4px; background: rgb(19, 29, 24); }
#chat-log { overscroll-behavior: contain; }
.loot-item, .toast { max-width: 100%; overflow-wrap: anywhere; }

/* desktop: keep the chat clear of the centred skill bar (≈620 px wide) */
#chat { width: clamp(260px, calc(50vw - 334px), 420px); }
#loot-feed { bottom: 236px; } /* above the menu grid */
@media (min-width: 901px) and (max-width: 1239px) {
  #chat, #chat-open-btn { bottom: 144px; }      /* medium screens: sit above the quick-slot row */
  #chat { width: min(340px, 34vw); }
  #chat-log { height: 120px; }
}
@media (max-height: 700px) and (min-width: 901px) { #chat-log { height: 96px; } #quest-tracker { max-height: 22vh; } }
.modal-card, .result-card { max-height: 90dvh; overflow-y: auto; }
#panels .panel { max-height: calc(100dvh - 150px); }

/* touch layouts (phones & tablets) */
@media (max-width: 900px) {
  #chat { width: min(300px, 60vw); }
  #chat-form { gap: 3px; padding: 4px; }
  #chat-ch { width: 64px; padding: 4px 3px; font-size: 11px; }
  #chat-to { width: 64px; }
  #chat-input { font-size: 16px; padding: 4px 6px; } /* 16px stops iOS zooming into the field */
  #chat-send { padding: 3px 8px; }
  /* while typing, the on-screen keyboard covers the bottom: lift the chat to the top */
  #chat.kb { position: fixed; top: 6px; bottom: auto; left: 6px; right: 6px; width: auto; z-index: 13000; }
  #chat.kb #chat-log { height: 110px; display: block; padding: 4px 8px; }
  #toasts { top: 118px; width: min(420px, 94vw); gap: 4px; }
  .toast { padding: 5px 10px; font-size: 12.5px; }
  #loot-feed { left: 50%; right: auto; bottom: 66px; transform: translateX(-50%); align-items: center; }
  .loot-item { font-size: 11.5px; padding: 2px 8px; }
  .loot-item img { width: 18px; height: 18px; }
  #prompts { top: 64px; right: auto; left: 50%; transform: translateX(-50%); width: min(340px, 94vw); z-index: 12500; }
  .prompt { padding: 8px; font-size: 13px; }
  #dg-bar { flex-wrap: wrap; justify-content: center; white-space: normal; row-gap: 2px; }
  #dg-bar:not(.hidden) ~ #event-banner { top: 150px; }
  #dg-bar:not(.hidden) ~ #boss-dmg { top: 150px; }
  .cp-pop { bottom: 110px; padding: 6px 14px; }
  .cp-pop-num { font-size: 22px; min-width: 80px; }
  .result-card { top: 12%; padding: 12px; }
  .rc-stars { font-size: 32px; }
  #npc-dialog { max-height: 56dvh; }
}
@media (max-width: 540px) {
  #chat { width: min(250px, 64vw); }
  #chat-log { height: 72px; }
  .chat-tabs button { font-size: 10.5px; padding: 3px 5px; }
  #toasts .toast:nth-last-child(n+4) { display: none; } /* phones: show the 3 newest */
  .duel-count { font-size: 40px; }
}
/* landscape phones: very little height — compact everything */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 560px) {
  #chat { width: min(240px, 30vw); }
  #chat.kb { top: 4px; left: 4px; right: 4px; width: auto; }
  #chat.kb #chat-log { height: 64px; }
  #chat-log { height: 56px; }
  #toasts { top: 52px; }
  #toasts .toast:nth-last-child(n+3) { display: none; }
  #prompts { top: 48px; }
  #loot-feed { bottom: 60px; }
  #dg-bar { top: 48px; }
  #dg-bar:not(.hidden) ~ #event-banner { top: 84px; }
  .result-card { top: 4%; }
  .rc-stars { font-size: 26px; }
  .cp-pop { bottom: 64px; }
}

/* MP cost printed on each skill slot; the slot dims when MP is short */
.sk .mpc { position: absolute; bottom: 0; right: 2px; font-size: 9px; font-weight: 700; color: #bae6fd; text-shadow: 0 1px 2px #000, 0 0 2px #000; pointer-events: none; }
.sk.nomp .mpc { color: #fca5a5; }
.sk.nomp .ico-img { filter: saturate(.35) brightness(.7); }
.stat-grid .stat-span { grid-column: 1 / -1; }
@media (max-width: 540px) { .sk .mpc { font-size: 7.5px; right: 1px; } }

/* desktop stacking (measured at 1366×768): right column minimap → bot → gift → quests, all clear of the menu grid */
@media (min-width: 901px) {
  #bot-panel { top: 250px; }
  #gift-btn { top: 312px; }
  #quest-tracker { top: 350px; max-height: max(60px, min(32vh, calc(100vh - 580px))); }
  #loot-feed { right: 204px; bottom: 236px; }              /* left of the right column, above the menu grid */
  #toasts { top: 30vh; width: min(440px, 92vw); }          /* upper third: clear of the target frame, event bars and invites */
  #boss-dmg { bottom: 252px; }                             /* just above the chat box */
}
@media (min-width: 901px) and (max-width: 1239px) { #boss-dmg { bottom: 340px; } }
#toasts .toast:nth-last-child(n+4) { display: none; }      /* never more than 3 toasts on screen */
@media (min-width: 901px) and (max-width: 1439px) {
  #prompts { top: 172px; width: 240px; z-index: 12500; } /* below the target frame / dungeon & event bars */
  #toasts { width: min(380px, 92vw); }
}
@media (min-width: 901px) { #loot-feed { max-height: max(90px, calc(100vh - 600px)); overflow: hidden; justify-content: flex-end; } }
@media (min-width: 901px) and (max-width: 1239px) {
  .sk { width: 44px; height: 44px; }
  #skillbar { gap: 4px; padding: 5px; }
  #menubar { grid-template-columns: repeat(5, 36px); gap: 3px; padding: 4px; }
  #menubar button { width: 36px; height: 36px; font-size: 16px; }
  #menubar button span { display: none; }
  #loot-feed { left: 50%; right: auto; transform: translateX(-50%); bottom: 146px; align-items: center; max-height: 150px; }
}

/* ---------- status stack: target frame, dungeon bar, war bar, event banner, boss ranking ---------- */
#top-stack { position: absolute; top: 10px; left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: calc(100vw - 420px); display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; z-index: 6; }
#top-stack > * { pointer-events: auto; position: static; top: auto; left: auto; right: auto; bottom: auto; transform: none; margin: 0; max-width: 100%; }
#top-stack > #target-frame { width: 300px; }
#top-stack > #dg-bar, #top-stack > #event-banner, #top-stack > #war-bar { white-space: normal; flex-wrap: wrap; justify-content: center; }
/* desktop: the boss ranking lives bottom-left above the chat (fixed works: the stack has no transform) */
@media (min-width: 901px) { #top-stack > #boss-dmg { position: fixed; left: 10px; bottom: 252px; } }
@media (min-width: 901px) and (max-width: 1239px) { #top-stack > #boss-dmg { bottom: 340px; } #top-stack { max-width: calc(100vw - 440px); } }

@media (max-width: 900px) {
  /* tablets & landscape phones: centred between the character frame and the minimap */
  #top-stack { top: 8px; max-width: calc(100vw - 400px); min-width: 180px; }
  #top-stack > #target-frame { width: min(240px, 100%); }
  #top-stack > #boss-dmg { width: min(220px, 100%); font-size: 11px; padding: 4px 6px; }
  #top-stack > #boss-dmg .bd-list .bd-row:nth-child(n+4), #top-stack > #boss-dmg > .dim { display: none; }
  #prompts { top: 40vh; }
  #toasts { top: 30vh; width: min(360px, 92vw); }
}
@media (max-width: 600px) and (orientation: portrait) {
  /* phones: no room between the frames, so the stack goes under the character frame, left of the right-hand buttons */
  #hud-player { width: min(222px, calc(100vw - 150px)); }
  #buff-bar { top: 128px; left: 10px; }
  #top-stack { top: 160px; left: 10px; right: auto; margin: 0; width: min(222px, calc(100vw - 150px)); max-width: none; min-width: 0; align-items: stretch; }
  #top-stack > #target-frame, #top-stack > #boss-dmg { width: auto; }
  #top-stack > #event-banner .eb-ico { display: none; }
  #mobile-menu-toggle { top: 196px; }
  #gift-btn { top: 244px; }
  /* quick slots: one row right above the skill bar (frees the right-hand column) */
  #quickbar { top: auto; bottom: 64px; right: auto; left: 50%; transform: translateX(-50%); display: flex; }
  #loot-feed { top: calc(50% + 34px); bottom: auto; max-height: 76px; overflow: hidden; }
  #prompts { top: 38%; }
  #top-stack > #party-frame { width: auto; }
}
@media (max-width: 900px) and (orientation: landscape) and (max-height: 560px) {
  #top-stack { top: 6px; max-width: calc(100vw - 340px); }
  #toasts { top: 40%; }
  #prompts { top: 30%; }
}

/* party frame keeps its left-hand spot on desktop/tablet (fixed: the stack has no transform) */
@media (min-width: 601px), (orientation: landscape) { #top-stack > #party-frame { position: fixed; top: 132px; left: 10px; } }
@media (max-width: 900px) and (orientation: landscape) and (max-height: 560px) { #top-stack > #party-frame { top: 120px; left: 6px; width: 160px; } }
@media (max-width: 600px) and (orientation: portrait) {
  /* compact party frame: names + HP only */
  #party-frame .dps-meter-wrap, #party-frame .pf-dps-btn, #party-frame .bar.mp { display: none; }
  #party-frame { padding: 4px 6px; }
  #party-frame .pf-row { padding: 1px 3px; }
  #party-frame .pf-name { font-size: 11px; }
  #chat, #chat-open-btn { bottom: 96px; }
  #quickbar { bottom: 63px; }
}
@media (max-width: 600px) and (orientation: portrait) and (max-height: 700px) {
  /* short phones (e.g. 360×640): smaller chat log, stack capped above the joystick */
  #chat-log { height: 52px; }
}

@media (max-width: 600px) and (orientation: portrait) {
  /* compact touch-action cluster (114 px tall instead of 244) so it never reaches the menu/gift buttons */
  #mobile-actions { display: grid; grid-template-columns: 42px 64px; grid-template-rows: 42px 32px 32px; grid-template-areas: "tgt auto" "ride atk" "dodge atk"; gap: 4px; right: 12px; bottom: 172px; }
  #mobile-actions button, #mobile-actions button + button { width: 42px; height: 42px; font-size: 18px; align-self: center; justify-self: center; }
  #mobile-actions #mob-attack { grid-area: atk; width: 64px; height: 64px; font-size: 26px; align-self: end; }
  #mobile-actions #mob-target { grid-area: tgt; }
  #mobile-actions #mob-auto { grid-area: auto; justify-self: end; }
  #mobile-actions #mob-ride { grid-area: ride; width: 38px; height: 38px; }
  #mobile-actions #mob-dodge { grid-area: dodge; position: static; width: 38px; height: 38px; }
  /* status stack: capped above the joystick, scrolls if a lot is showing; party before boss ranking */
  #top-stack { max-height: calc(100% - 450px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  #top-stack > #party-frame { order: 3; }
  #top-stack > #event-banner { order: 4; }
  #top-stack > #boss-dmg { order: 5; }
}
@media (max-width: 900px) and (orientation: landscape) and (max-height: 560px) {
  /* compact party frame, capped above the joystick */
  #party-frame .dps-meter-wrap, #party-frame .pf-dps-btn, #party-frame .bar.mp { display: none; }
  #top-stack > #party-frame { top: 118px; width: 150px; max-height: calc(100dvh - 118px - 150px); overflow-y: auto; padding: 3px 5px; }
  #party-frame .pf-name { font-size: 10.5px; }
  /* menu toggle + menu sit left of the minimap instead of on top of it */
  #mobile-menu-toggle { top: 6px; right: 130px; }
  #menubar { top: 52px; right: 130px; max-height: calc(100dvh - 60px); }
  #toasts { top: 26%; width: min(340px, 50vw); }
  #loot-feed { left: 62%; top: calc(50% + 10px); bottom: auto; max-height: 72px; overflow: hidden; }
}
@media (min-width: 601px) and (max-width: 900px) and (min-height: 561px) {
  /* tablets: centre the stack in the gap between the character frame (≤240px) and the minimap (right 138px) */
  #top-stack { left: 250px; right: 144px; max-width: none; }
  #mobile-menu-toggle { top: 196px; }
  #gift-btn { top: 244px; }
  #loot-feed { top: calc(50% + 40px); bottom: auto; max-height: 100px; overflow: hidden; }
}
@media (min-width: 901px) { #top-stack > #boss-dmg { left: 222px; } } /* right of the party frame column */

/* ================= v2.4 — job advancement, achievements, login calendar, mail ================= */
.job-box { width: 100%; margin: 4px 0 8px; padding: 8px; border-radius: 10px; background: rgba(250,204,21,.07); border: 1px solid rgba(250,204,21,.35); }
.job-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-weight: 700; color: #fde68a; margin-bottom: 6px; }
.job-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.job-card { display: flex; flex-direction: column; gap: 5px; padding: 8px; border-radius: 9px; border: 1px solid color-mix(in srgb, var(--jc) 55%, transparent); background: color-mix(in srgb, var(--jc) 9%, #131d17); }
.job-card.cur { box-shadow: 0 0 0 2px var(--jc); }
.job-title { font-family: 'Kanit'; font-weight: 700; color: var(--jc); }
.job-stats { color: #86efac; }
.job-skill { display: flex; gap: 6px; align-items: flex-start; }
.job-skill img { width: 34px; height: 34px; border-radius: 7px; flex: 0 0 auto; }
.ach-top { display: grid; gap: 4px; margin-bottom: 8px; }
.ach-tabs { flex-wrap: wrap; margin-bottom: 8px; }
.ach-tabs .tab { font-size: 12px; padding: 4px 8px; }
.ach-list { display: flex; flex-direction: column; gap: 6px; }
.ach-row { display: flex; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 8px; background: rgba(31,45,36,.7); border: 1px solid rgba(151,178,145,.25); }
.ach-row.ready { border-color: var(--gold); background: rgba(97,83,42,.3); }
.ach-row.claimed { opacity: .6; }
.ach-main { flex: 1; min-width: 0; }
.ach-main .bar { margin: 4px 0 2px; }
.login-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.login-day { position: relative; padding: 6px 3px; border-radius: 8px; text-align: center; font-size: 11px; background: rgba(31,45,36,.75); border: 1px solid rgba(151,178,145,.3); }
.login-day .ld-n { font-weight: 700; color: #fde68a; margin-bottom: 3px; }
.login-day img { width: 18px; height: 18px; vertical-align: middle; }
.login-day.claimed { opacity: .55; }
.login-day.next { border-color: var(--gold); box-shadow: 0 0 10px rgba(250,204,21,.45); animation: pulse 1.4s infinite; }
.login-day.big { background: rgba(120,83,31,.4); }
.ld-ok { position: absolute; top: 2px; right: 4px; color: #4ade80; font-weight: 700; }
@media (max-width: 560px) { .login-grid { grid-template-columns: repeat(4, 1fr); } }
.mail-wrap { display: grid; grid-template-columns: minmax(180px, 38%) 1fr; gap: 10px; min-height: 240px; }
.mail-list { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; }
.mail-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 6px 8px; border-radius: 7px; border: 1px solid rgba(151,178,145,.25); background: rgba(31,45,36,.7); color: var(--text); cursor: pointer; font-family: inherit; }
.mail-row b { font-weight: 500; font-size: 12.5px; }
.mail-row.unread b { font-weight: 700; color: #fde68a; }
.mail-row small { color: var(--dim); font-size: 10.5px; }
.mail-row.sel { border-color: var(--gold); }
.mail-view { padding: 8px 10px; border-radius: 8px; background: rgba(0,0,0,.22); border: 1px solid var(--line); }
.mail-title { font-family: 'Kanit'; font-weight: 700; color: #fde68a; }
.mail-text { margin: 8px 0; line-height: 1.55; font-size: 13px; }
.mail-att { display: flex; flex-wrap: wrap; gap: 4px; }
@media (max-width: 560px) { .mail-wrap { grid-template-columns: 1fr; } .mail-list { max-height: 160px; } }
