:root { --gold: #e8c66a; --gold2: #b8943a; --line: #5d4d28; --txt: #efe6cf; --mut: #a79f8a; --sect: #f5c542; --pan: rgba(18, 20, 28, .94); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0d12; color: var(--txt);
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
p { margin: 4px 0; }
kbd { display: inline-block; min-width: 20px; padding: 0 5px; margin: 0 2px; border: 1px solid #6b6248; border-bottom-width: 2px; border-radius: 4px;
  background: #23262f; color: var(--gold); font: 600 11px/17px -apple-system, Arial, sans-serif; text-align: center; }
.mut { color: var(--mut); font-size: 12px; }
.good { color: #6dff8a; } .bad { color: #ff7b7b; }
em { font-style: normal; color: var(--mut); font-size: 12px; }

/* ---------- Màn chọn môn phái ---------- */
#select { position: fixed; inset: 0; z-index: 20; overflow: auto; display: flex;
  background: radial-gradient(ellipse at 50% 30%, rgba(20, 24, 36, .7), rgba(6, 8, 12, .94)); }
.sel-inner { width: min(1080px, 96vw); margin: auto; padding: 20px 0 26px; }
#select h1 { margin: 0; text-align: center; font: 700 46px/1.1 "Times New Roman", Georgia, serif; letter-spacing: 6px; color: var(--gold);
  text-shadow: 0 2px 0 #5a4310, 0 0 28px rgba(232, 198, 106, .45); }
.sub { text-align: center; color: var(--mut); margin: 6px 0 16px; }
#sectCards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.card { background: linear-gradient(180deg, rgba(34, 38, 52, .92), rgba(18, 20, 28, .92)); border: 1px solid #3a3526; border-radius: 10px;
  padding: 8px 8px 12px; text-align: center; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.card:hover { transform: translateY(-3px); border-color: var(--c); }
.card.on { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 0 26px -6px var(--c); background: linear-gradient(180deg, rgba(48, 50, 62, .95), rgba(22, 24, 32, .95)); }
.card canvas { width: 110px; height: 120px; }
.cname { font: 700 18px "Times New Roman", Georgia, serif; color: var(--c); letter-spacing: 1px; }
.cel { font-size: 12px; margin-top: 2px; }
.crole { font-size: 12px; color: var(--mut); }
#sectDetail { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; margin-top: 14px; padding: 14px 18px;
  background: rgba(16, 18, 26, .92); border: 1px solid #3a3526; border-left: 3px solid var(--c); border-radius: 10px; }
#sectDetail h2 { margin: 0 0 4px; font: 700 24px "Times New Roman", Georgia, serif; color: var(--c); letter-spacing: 1px; }
#sectDetail h3 { margin: 0 0 6px; font: 700 15px "Times New Roman", Georgia, serif; color: var(--gold); letter-spacing: 1px; }
.dsc { color: #d8d0ba; margin-bottom: 10px; }
.brow { display: flex; align-items: center; gap: 10px; font-size: 13px; margin: 3px 0; }
.brow span { width: 76px; color: var(--mut); }
.brow i { display: flex; gap: 4px; }
.brow b { width: 26px; height: 8px; border-radius: 2px; background: #2c2f3a; }
.brow b.on { background: var(--c); }
.khac { font-size: 12.5px; color: #cfc7b0; margin-top: 10px; }
.srow, .skrow { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; border-top: 1px solid rgba(255, 255, 255, .06); }
.srow:first-of-type { border-top: 0; }
.srow p, .skrow p { margin: 1px 0 0; font-size: 12.5px; color: #cfc7b0; }
.sic { flex: none; width: 36px; height: 36px; border-radius: 7px; display: grid; place-items: center; font-size: 20px;
  background: radial-gradient(circle at 30% 25%, #3a3d4a, #17181f); border: 1px solid var(--c, var(--sect)); }
.sel-actions { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 16px; flex-wrap: wrap; }
#nameInput { width: 230px; height: 46px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #14161d; color: var(--txt);
  font: 16px -apple-system, Arial, sans-serif; outline: none; user-select: text; -webkit-user-select: text; }
#nameInput:focus { border-color: var(--gold); }
.btn { border: 1px solid var(--gold2); border-radius: 8px; background: linear-gradient(180deg, #d9b24a, #a37a1e); color: #1d1503; font-weight: 700; padding: 8px 16px; }
.btn.big { height: 46px; padding: 0 26px; font-size: 16px; letter-spacing: .5px; }
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: rgba(20, 22, 30, .9); color: var(--gold); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { position: absolute; }
#pframe { left: 12px; top: 12px; display: flex; gap: 10px; align-items: center; padding: 8px 14px 8px 8px; width: 318px;
  background: var(--pan); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 18px rgba(0, 0, 0, .45); }
#portrait { width: 72px; height: 72px; border-radius: 50%; border: 2px solid var(--sect); background: radial-gradient(circle at 50% 35%, #3a4052, #14161d); flex: none; }
.pinfo { flex: 1; min-width: 0; }
.pname { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
#pName { font: 700 16px "Times New Roman", Georgia, serif; color: var(--sect); letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pLvl { font-size: 12px; color: var(--gold); font-weight: 700; flex: none; }
.bar { position: relative; height: 17px; border-radius: 4px; background: #0b0c10; border: 1px solid #2c2a22; overflow: hidden; margin-top: 4px; }
.bar .fill { height: 100%; width: 100%; transition: width .12s linear; }
.bar span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 11px/1 -apple-system, Arial, sans-serif; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; white-space: pre; }
.bar.hp .fill { background: linear-gradient(180deg, #ff6b6b, #b81d2a); }
.bar.mp .fill { background: linear-gradient(180deg, #5db4ff, #1c58c0); }
.bar.thp .fill { background: linear-gradient(180deg, #ff8a4c, #c0301d); }
#buffs { min-height: 18px; margin-top: 3px; font-size: 13px; color: var(--gold); white-space: pre; }
#tframe { left: 50%; top: 12px; transform: translateX(-50%); width: 320px; padding: 7px 12px 9px; text-align: center;
  background: var(--pan); border: 1px solid var(--line); border-radius: 10px; }
#tName { font-weight: 700; font-size: 13px; }
#mapbox { right: 12px; top: 12px; width: 214px; padding: 6px; background: var(--pan); border: 1px solid var(--line); border-radius: 10px; text-align: center; }
#zoneLabel { font: 700 14px "Times New Roman", Georgia, serif; color: var(--gold); letter-spacing: 1px; margin-bottom: 4px; }
#minimap { width: 200px; height: 140px; display: block; border-radius: 5px; border: 1px solid #2c2a22; }
#goldBox { margin-top: 4px; font-size: 13px; color: #ffd86b; font-weight: 600; }
#quest { right: 12px; top: 218px; width: 214px; padding: 8px 12px 10px; background: rgba(18, 20, 28, .86); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 10px; font-size: 13px; }
#quest h5 { margin: 0 0 2px; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--mut); font-weight: 600; }
#quest b { color: var(--gold); font: 700 15px "Times New Roman", Georgia, serif; }
.qn { color: #6dff8a; font-weight: 700; }
#log { left: 14px; bottom: 124px; width: 400px; display: flex; flex-direction: column; gap: 1px; font-size: 13px; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
#log div { animation: logfade 12s forwards; }
@keyframes logfade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
#bottom { left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
#skillbar { display: flex; gap: 6px; align-items: center; padding: 7px 9px; background: var(--pan); border: 1px solid var(--line); border-radius: 12px; pointer-events: auto;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .5); }
.slot { position: relative; width: 56px; height: 56px; border-radius: 8px; border: 1px solid var(--gold2); overflow: hidden; cursor: pointer;
  background: radial-gradient(circle at 30% 25%, #3d4150, #15161c); }
.slot > * { pointer-events: none; }
.slot:hover { border-color: #fff1b8; }
.slot .ic { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; }
.slot .key { position: absolute; left: 3px; top: 2px; font: 700 10px/1 -apple-system, Arial, sans-serif; color: var(--gold); text-shadow: 0 1px 2px #000; }
.slot .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0, 0, 0, .72); }
.slot .cdt { position: absolute; inset: 0; display: grid; place-items: center; font: 800 20px/1 -apple-system, Arial, sans-serif; color: #fff; text-shadow: 0 1px 3px #000; }
.slot .lock { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(8, 9, 12, .82); font: 700 11px/1 -apple-system, Arial, sans-serif; color: #b8b09a; }
.slot .cnt { position: absolute; right: 3px; bottom: 2px; font: 800 12px/1 -apple-system, Arial, sans-serif; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.slot.active { border-color: #6dff8a; box-shadow: 0 0 12px #2fbf55, inset 0 0 12px rgba(80, 255, 130, .35); }
.sep { width: 1px; height: 40px; background: var(--line); margin: 0 3px; }
#expbar { position: relative; width: 560px; max-width: 80vw; height: 12px; border-radius: 6px; background: #0b0c10; border: 1px solid #2c2a22; overflow: hidden; }
#expbar .fill { height: 100%; width: 0; background: linear-gradient(90deg, #7a4fe0, #c9a0ff); transition: width .2s; }
#expbar span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 9px/1 -apple-system, Arial, sans-serif; color: #fff; text-shadow: 0 1px 2px #000; }
#menu { right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 5px; pointer-events: auto; }
#menu button { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 132px; padding: 5px 9px; border-radius: 7px;
  background: var(--pan); border: 1px solid var(--line); font-size: 13px; }
#menu button:hover { border-color: var(--gold); }
#menu button.pulse { border-color: #ffd23f; animation: pulse 1.1s infinite; }
#menu button.off { opacity: .5; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 63, .7); } 50% { box-shadow: 0 0 0 6px rgba(255, 210, 63, 0); } }

/* ---------- Bảng ---------- */
.panel { position: fixed; left: 12px; top: 112px; width: 400px; max-height: calc(100vh - 250px); z-index: 10; display: flex; flex-direction: column;
  background: var(--pan); border: 1px solid var(--gold2); border-radius: 10px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }
#pHelp { left: 50%; top: 50%; transform: translate(-50%, -54%); width: min(640px, 94vw); max-height: 84vh; }
.ph { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line);
  font: 700 16px "Times New Roman", Georgia, serif; color: var(--gold); letter-spacing: 1px; }
.ph .x { border: 0; background: none; color: var(--mut); font-size: 15px; padding: 2px 6px; }
.ph .x:hover { color: #fff; }
.pb { padding: 10px 12px 12px; overflow: auto; }
.pb h4 { margin: 10px 0 6px; font-size: 13px; font-weight: 600; color: var(--txt); }
.pts { color: #ffd23f; font-size: 16px; }
.who { font-size: 15px; margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 16px; }
.row { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dashed rgba(255, 255, 255, .08); font-size: 13px; }
.row span { color: var(--mut); }
.arow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid rgba(255, 255, 255, .06); }
.arow p { font-size: 12px; color: var(--mut); margin: 0; }
.arow .val { color: #ffd23f; font-weight: 700; margin-left: 6px; }
.abtn { display: flex; gap: 5px; flex: none; }
.panel button[data-act], #dialog button { border: 1px solid var(--gold2); border-radius: 6px; background: linear-gradient(180deg, #3a3524, #25221a); color: var(--gold); padding: 4px 10px; font-weight: 600; font-size: 13px; }
.panel button[data-act]:hover, #dialog button:hover { filter: brightness(1.3); }
.panel button[disabled] { opacity: .35; cursor: default; filter: none !important; }
.skrow { align-items: center; padding: 8px 0; }
.skrow .skinfo { flex: 1; }
.skrow.locked { opacity: .55; }
.eqrow { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.eq { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 7px; border: 1px solid var(--rc); background: #15171e; cursor: pointer; min-height: 40px; }
.eq.empty { border-style: dashed; color: var(--mut); cursor: default; }
.eq .eic { font-size: 20px; }
.eq .en { font-size: 12.5px; color: var(--rc); font-weight: 600; line-height: 1.2; }
.eq.empty .en { color: var(--mut); font-weight: 400; }
.bag { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.cell { position: relative; aspect-ratio: 1; border-radius: 6px; border: 1px solid var(--rc); background: radial-gradient(circle at 30% 25%, #2d303b, #14151b);
  display: grid; place-items: center; font-size: 24px; cursor: pointer; box-shadow: inset 0 0 10px -3px var(--rc); }
.cell > * { pointer-events: none; }
.cell:hover { filter: brightness(1.3); }
.cell.empty { border-color: #2a2c35; box-shadow: none; cursor: default; filter: none; }
.cell i { position: absolute; right: 3px; bottom: 1px; font: 700 10px/1.2 -apple-system, Arial, sans-serif; color: #fff; text-shadow: 0 1px 2px #000; }
.bagfoot { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 4px; font-size: 13px; color: #ffd86b; }
.help .hrow { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid rgba(255, 255, 255, .06); font-size: 13.5px; }
.help .hrow:first-child { border-top: 0; }
.help .hrow b { color: var(--gold); }

/* ---------- NPC, tử trận, thông báo ---------- */
#dialog { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); width: min(560px, 94vw); z-index: 11; padding: 14px 18px;
  background: var(--pan); border: 1px solid var(--gold2); border-radius: 10px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }
#dialog h3 { margin: 0 0 6px; font: 700 18px "Times New Roman", Georgia, serif; color: #ffe27a; letter-spacing: 1px; }
.dbtn { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#dialog button.ghost { background: none; border-color: var(--line); color: var(--mut); }
#death { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(40, 0, 0, .55); }
.dbox { text-align: center; padding: 26px 34px; background: var(--pan); border: 1px solid #a33; border-radius: 12px; max-width: 460px; }
.dbox h2 { margin: 0 0 8px; font: 700 34px "Times New Roman", Georgia, serif; color: #ff6b6b; letter-spacing: 3px; }
.dbox p { margin-bottom: 16px; color: #d8d0ba; }
#banner { position: fixed; left: 0; right: 0; top: 23%; z-index: 9; text-align: center; pointer-events: none; opacity: 0; }
#banner.show { animation: banner 2.1s ease-out forwards; }
.bt { font: 700 44px/1.1 "Times New Roman", Georgia, serif; letter-spacing: 5px; color: var(--gold); text-shadow: 0 2px 0 #4a3608, 0 0 30px rgba(232, 198, 106, .7), 0 0 4px #000; }
.bs { margin-top: 6px; font-size: 15px; color: #f3ead2; text-shadow: 0 1px 3px #000, 0 0 6px #000; }
@keyframes banner { 0% { opacity: 0; transform: scale(1.25); } 12% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
#toast { position: fixed; left: 50%; bottom: 128px; transform: translateX(-50%); z-index: 12; padding: 6px 16px; border-radius: 18px; pointer-events: none; opacity: 0;
  background: rgba(10, 11, 15, .88); border: 1px solid var(--line); color: #ffe9b0; font-size: 13.5px; white-space: nowrap; }
#toast.show { animation: toast 1.9s forwards; }
@keyframes toast { 0% { opacity: 0; } 10%, 75% { opacity: 1; } 100% { opacity: 0; } }
#tooltip { position: fixed; z-index: 40; max-width: 290px; padding: 9px 12px; pointer-events: none; font-size: 13px;
  background: rgba(10, 11, 16, .97); border: 1px solid var(--gold2); border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, .6); }
#tooltip b { font-size: 14.5px; }

@media (max-width: 1100px) {
  #sectCards { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  #sectDetail { grid-template-columns: 1fr; }
  #log { width: 300px; }
  #tframe { width: 260px; }
}
@media (max-height: 760px) {
  #select h1 { font-size: 34px; }
  .card canvas { width: 82px; height: 90px; }
  #quest { top: 212px; }
}

/* ---------- Trực tuyến: đăng nhập, chat ---------- */
#modeNote { text-align: center; color: #ffe9b0; min-height: 20px; margin: 0 0 10px; }
#authBox, #charBox { width: min(420px, 92vw); margin: 10px auto 0; padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 10px; text-align: center;
  background: rgba(16, 18, 26, .94); border: 1px solid var(--gold2); border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tabs button { height: 38px; border-radius: 8px; border: 1px solid var(--line); background: #14161d; color: var(--mut); font-weight: 600; }
.tabs button.on { border-color: var(--gold); color: var(--gold); background: #23210f; }
#authBox input { height: 44px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #14161d; color: var(--txt);
  font: 15px -apple-system, Arial, sans-serif; outline: none; user-select: text; -webkit-user-select: text; }
#authBox input:focus { border-color: var(--gold); }
#authMsg { min-height: 20px; color: #ff9c8a; margin: 0; }
.btn[disabled] { opacity: .5; cursor: default; }
#charName { font: 700 30px "Times New Roman", Georgia, serif; letter-spacing: 1px; }
#charSub { color: var(--txt); margin-bottom: 6px; }
#onlineBox { margin-top: 2px; font-size: 12.5px; color: #9be7a8; }
#chatBox { left: 14px; bottom: 92px; width: 330px; pointer-events: auto; }
#chatInput { width: 100%; height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line); background: rgba(10, 11, 15, .72); color: var(--txt);
  font: 13px -apple-system, Arial, sans-serif; outline: none; user-select: text; -webkit-user-select: text; }
#chatInput:focus { border-color: var(--gold); background: rgba(10, 11, 15, .92); }
#log.net { bottom: 128px; }
#log div.chat { animation: logfade 30s forwards; }
#netLost { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; background: rgba(6, 8, 12, .7); }
#netLost h2 { color: var(--gold); font-size: 28px; }
#menu #mLogout { justify-content: center; color: var(--mut); }
#hud.net #quest { top: 240px; }
#deathBy { color: #ffb3a8; font-weight: 600; min-height: 0; margin: 0 0 6px; }

/* ================= Giao diện cổ điển: khung gỗ sơn son thếp vàng ================= */
:root { --gold: #f0cf78; --gold2: #b8943a; --line: #8a6a2f; --txt: #f3e9cf; --mut: #b8a98a;
  --pan: linear-gradient(180deg, rgba(58, 30, 18, .97), rgba(27, 13, 9, .97)); }
body { background: #0a0705; }
#pframe, #tframe, #mapbox, #quest, #skillbar, .panel, #dialog, .dbox, #authBox, #charBox, #sectDetail, #tooltip {
  background: var(--pan); border: 2px solid var(--line); border-radius: 6px;
  box-shadow: 0 0 0 1px #160a05, inset 0 0 0 1px rgba(255, 220, 140, .16), inset 0 0 26px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .55); }
#sectDetail { border-left: 2px solid var(--line); border-top: 3px solid var(--c); }
.ph { position: relative; justify-content: center; padding: 9px 12px; font-size: 17px; letter-spacing: 2px; color: var(--gold); text-shadow: 0 1px 0 #2a0a06;
  background: linear-gradient(180deg, #8f261b, #55120c); border-bottom: 2px solid var(--gold2); border-radius: 3px 3px 0 0; }
.ph .x { position: absolute; right: 8px; top: 7px; color: var(--gold); }
.panel::before, .panel::after { content: ''; position: absolute; top: -7px; width: 12px; height: 12px; z-index: 2;
  background: linear-gradient(135deg, #f6dc8e, #a87a22); border: 1px solid #5a3a10; transform: rotate(45deg); }
.panel::before { left: -7px; } .panel::after { right: -7px; }
#portrait { border: 3px solid var(--gold2); box-shadow: 0 0 0 2px #160a05, 0 0 10px -2px var(--sect); background: radial-gradient(circle at 50% 35%, #5a3a2a, #1a0d08); }
.bar { height: 16px; border: 1px solid #5a4320; border-radius: 3px; background: #100806; }
#rightcol { right: 12px; top: 12px; width: 234px; display: flex; flex-direction: column; gap: 8px; }
#rightcol > * { position: static; width: auto; }
#minimap { width: 214px; height: 100px; margin: 0 auto; border: 1px solid #5a4320; }
#zoneLabel { font-size: 15px; letter-spacing: 2px; color: var(--gold); text-shadow: 0 1px 0 #2a0a06; }
#quest { border-left: 2px solid var(--line); }
#quest b { color: var(--gold); }
#bottom { bottom: 8px; }
.hudrow { display: flex; align-items: flex-end; gap: 12px; }
.midcol { display: flex; flex-direction: column; align-items: center; gap: 6px; }
#expbar { width: 100%; max-width: none; border-color: #5a4320; }
#skillbar { padding: 8px 10px; border-radius: 8px; }
.slot { border: 2px solid #a8842f; border-radius: 6px; background: radial-gradient(circle at 30% 25%, #4f3626, #170d08);
  box-shadow: inset 0 0 0 1px #160a05, inset 0 0 10px rgba(0, 0, 0, .6); }
.slot .key { left: 2px; top: 2px; padding: 1px 3px; border-radius: 3px; background: rgba(0, 0, 0, .6); color: var(--gold); }
.sep { background: var(--line); }
.orb { position: relative; width: 92px; height: 92px; border-radius: 50%; overflow: hidden; flex: none; pointer-events: auto;
  border: 3px solid var(--gold2); background: radial-gradient(circle at 50% 40%, #2c2622, #0c0908);
  box-shadow: 0 0 0 2px #160a05, 0 0 0 4px rgba(184, 148, 58, .35), 0 6px 16px rgba(0, 0, 0, .6); }
.ofill { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; transition: height .15s linear; }
.orb.hp .ofill { background: linear-gradient(180deg, #ff8676, #cf2330 45%, #6a0a14); }
.orb.mp .ofill { background: linear-gradient(180deg, #7cc6ff, #2466d6 45%, #0c2a6a); }
.oshine { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 16px rgba(0, 0, 0, .75);
  background: radial-gradient(circle at 32% 24%, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 36%); }
.orb span { position: absolute; inset: 0; display: grid; place-items: center; font: 800 15px/1 -apple-system, Arial, sans-serif; color: #fff; text-shadow: 0 1px 3px #000, 0 0 6px #000; }
#menu button { background: var(--pan); border: 2px solid var(--line); border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(255, 220, 140, .14); }
#chatInput { border: 2px solid var(--line); border-radius: 5px; background: rgba(30, 14, 9, .8); }
#chatInput:focus { background: rgba(30, 14, 9, .95); }
.panel button[data-act], #dialog button { border: 1px solid var(--gold2); background: linear-gradient(180deg, #6a3a1e, #3a1d10); color: var(--gold); }
.cell, .eq { background: radial-gradient(circle at 30% 25%, #4a3020, #170d08); }
.cell.empty { border-color: #4a3320; }
.sic { background: radial-gradient(circle at 30% 25%, #4f3626, #170d08); border-width: 2px; }
/* Màn chọn môn phái: 10 phái, hai hàng, mỗi cột một hệ ngũ hành */
#select { background: radial-gradient(ellipse at 50% 18%, rgba(70, 32, 16, .7), rgba(8, 5, 3, .95)); }
#select h1 { font-size: 44px; color: #f6dc8e; text-shadow: 0 2px 0 #6a1a10, 0 0 30px rgba(240, 190, 90, .5); }
#select h1::after { content: ''; display: block; width: 340px; max-width: 70%; height: 2px; margin: 8px auto 0; background: linear-gradient(90deg, transparent, #c9a24a, transparent); }
.sub { margin: 8px 0 12px; }
#sectCards { gap: 9px; }
.card { position: relative; padding: 5px 6px 8px; border: 2px solid #5a4320; border-radius: 6px; background: var(--pan); box-shadow: inset 0 0 22px rgba(0, 0, 0, .4); }
.card.on { background: linear-gradient(180deg, rgba(84, 44, 26, .97), rgba(36, 18, 11, .97)); box-shadow: 0 0 0 1px #160a05, 0 0 22px -4px var(--c), inset 0 0 22px rgba(0, 0, 0, .3); }
.card canvas { width: 84px; height: 92px; }
.cname { font-size: 16px; }
.cel, .crole { font-size: 11.5px; line-height: 1.3; }
.seal { position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font: 700 11px "Times New Roman", Georgia, serif; color: #1a0c06; border: 2px solid rgba(255, 255, 255, .55); box-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
#sectDetail { margin-top: 10px; padding: 10px 16px; }
#sectDetail h2 { font-size: 22px; }
.srow, .skrow { padding: 4px 0; }
.btn { border: 2px solid #f6dc8e; background: linear-gradient(180deg, #e6c05a, #a8781e); box-shadow: 0 0 0 1px #3a2408, 0 4px 10px rgba(0, 0, 0, .5); }
.btn.ghost { border-color: var(--line); background: var(--pan); }
#nameInput, #authBox input { border: 2px solid var(--line); background: #1a0d08; }
.tabs button { border: 2px solid #5a4320; background: #1a0d08; }
.tabs button.on { background: linear-gradient(180deg, #8f261b, #55120c); border-color: var(--gold2); }
@media (max-height: 800px) { .card canvas { width: 74px; height: 81px; } #select h1 { font-size: 36px; } }

/* ---------- Ảnh vẽ tay: biểu tượng chưởng, chân dung, huy hiệu ---------- */
.ii { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.ii.fit { object-fit: contain; padding: 4px; background: radial-gradient(circle at 30% 25%, #4f3626, #170d08); }
.sic { position: relative; overflow: hidden; }
.sic { width: 40px; height: 40px; }
.slot .ic { overflow: hidden; border-radius: 4px; }
.card canvas { width: 104px; height: 113px; }
#sectDetail.hasart { grid-template-columns: 150px 1fr 1.3fr; }
.dart { position: relative; min-height: 230px; overflow: hidden; border-radius: 4px; background: radial-gradient(ellipse at 50% 40%, rgba(255, 220, 140, .14), rgba(0, 0, 0, 0) 70%); }
.dart img { position: absolute; left: 50%; top: 4px; height: calc(100% - 8px); transform: translateX(-50%); filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .6)); }
.emb { position: relative; display: inline-block; width: 38px; height: 38px; margin-right: 8px; vertical-align: middle; }
.emb .ii.fit { padding: 0; background: none; }
#portrait { background-color: #1a0d08; }
@media (max-height: 800px) { .card canvas { width: 84px; height: 91px; } }

/* ================= Điện thoại và máy tính bảng ================= */
html, body { overscroll-behavior: none; touch-action: manipulation; }
#game { touch-action: none; }
#joy, #menuBtn, #chatBtn, #rotate, .touchonly, .help .hrow.touchonly { display: none; }
.touch kbd, .touch .slot .key { display: none; }
.touch #joy { display: block; left: max(14px, env(safe-area-inset-left)); bottom: 16px; width: 136px; height: 136px; border-radius: 50%; pointer-events: auto; touch-action: none;
  background: radial-gradient(circle, rgba(30, 16, 10, .52), rgba(30, 16, 10, .26)); border: 2px solid rgba(240, 207, 120, .5); box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }
.touch #joyKnob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; opacity: .92;
  background: radial-gradient(circle at 35% 30%, #f6dc8e, #8a6a2f); box-shadow: 0 2px 8px rgba(0, 0, 0, .6); }
.touch .orb { display: none; }
.touch #bottom { left: auto; right: max(10px, env(safe-area-inset-right)); bottom: 10px; transform: none; }
.touch #skillbar { display: grid; grid-template-columns: repeat(3, 58px); grid-auto-rows: 58px; gap: 7px; padding: 0; background: none; border: 0; box-shadow: none; }
.touch #skillbar .sep { display: none; }
.touch .slot { width: 58px; height: 58px; border-radius: 50%; }
.touch .slot .ic { border-radius: 50%; }
.touch #slot_auto { grid-area: 1 / 1; } .touch #slot_hp { grid-area: 1 / 2; } .touch #slot_mp { grid-area: 1 / 3; }
.touch #slot_s2 { grid-area: 2 / 1; } .touch #slot_s3 { grid-area: 2 / 2; } .touch #slot_s4 { grid-area: 2 / 3; }
.touch #slot_s0 { grid-area: 3 / 1; } .touch #slot_s1 { grid-area: 3 / 2; } .touch #slot_basic { grid-area: 3 / 3; }
.touch #slot_basic { border-color: #ffd23f; box-shadow: 0 0 10px rgba(255, 210, 63, .5), inset 0 0 0 1px #160a05; }
.touch #expbar { position: fixed; left: 50%; bottom: 3px; transform: translateX(-50%); width: 30vw; height: 7px; }
.touch #expbar span { display: none; }
.touch #pframe { left: 6px; top: 6px; width: 226px; padding: 5px 8px 5px 5px; gap: 7px; }
.touch #portrait { width: 46px; height: 46px; }
.touch .bar { height: 13px; margin-top: 3px; } .touch .bar span { font-size: 9.5px; }
.touch #pName { font-size: 13px; } .touch #buffs { min-height: 0; font-size: 11px; }
.touch #tframe { top: 6px; width: 210px; padding: 4px 8px 6px; } .touch #tName { font-size: 11px; }
.touch #rightcol { right: 6px; top: 6px; width: 164px; gap: 5px; }
.touch #mapbox { padding: 4px; } .touch #minimap { width: 150px; height: 70px; } .touch #zoneLabel { font-size: 12px; margin-bottom: 2px; letter-spacing: 1px; }
.touch #goldBox, .touch #onlineBox { font-size: 11px; margin-top: 1px; }
.touch #quest { padding: 5px 8px; font-size: 11px; } .touch #quest h5, .touch #quest .mut { display: none; } .touch #quest b { font-size: 12.5px; }
.touch #menuBtn, .touch #chatBtn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 8px; pointer-events: auto; font-size: 18px; color: var(--gold); background: var(--pan); border: 2px solid var(--line); }
.touch #menuBtn { right: 176px; top: 6px; } .touch #chatBtn { left: 162px; bottom: 16px; }
.touch #menu { display: none; right: 176px; top: 50px; bottom: auto; z-index: 12; } .touch #menu.open { display: flex; }
.touch #menu button { width: 150px; padding: 9px 12px; font-size: 14px; }
.touch #log, .touch #log.net { left: 8px; bottom: 164px; width: 44vw; font-size: 11px; }
.touch #chatBox { display: none; left: 50%; top: 54px; bottom: auto; transform: translateX(-50%); width: min(420px, 80vw); z-index: 13; } .touch #chatBox.open { display: block; }
.touch #chatInput { height: 40px; font-size: 16px; }
.touch #toast { bottom: auto; top: 58px; font-size: 12px; }
.touch #banner { top: 17%; } .touch .bt { font-size: 26px; letter-spacing: 3px; } .touch .bs { font-size: 12px; }
.touch .panel, .touch #pHelp { left: 2vw; right: 2vw; top: 6px; width: auto; transform: none; max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px); z-index: 14; }
.touch .ph .x { font-size: 20px; padding: 4px 10px; top: 3px; }
.touch .panel button[data-act], .touch #dialog button { padding: 9px 14px; font-size: 14px; }
.touch #dialog { bottom: auto; top: 50%; transform: translate(-50%, -50%); max-height: 92vh; max-height: 92dvh; overflow: auto; z-index: 14; }
.touch .touchonly, .touch .help .hrow.touchonly { display: grid; }
.touch #nameInput, .touch #authBox input { font-size: 16px; }
.touch #select { -webkit-overflow-scrolling: touch; touch-action: pan-y; }
@media (max-width: 700px) {
  #sectCards { grid-template-columns: repeat(2, 1fr); }
  #sectDetail, #sectDetail.hasart { grid-template-columns: 1fr; }
  .dart { display: none; }
  #select h1 { font-size: 28px; letter-spacing: 3px; } .sub { font-size: 12px; }
  .touch #pframe { width: 196px; } .touch #tframe { top: 64px; left: 6px; transform: none; width: 196px; }
  .touch #rightcol { width: 132px; } .touch #minimap { width: 118px; height: 55px; }
  .touch #menuBtn, .touch #menu { right: 144px; }
  .touch #log, .touch #log.net { width: 60vw; }
}
@media (max-height: 460px) { /* điện thoại cầm ngang */
  .touch #skillbar { grid-template-columns: repeat(3, 54px); grid-auto-rows: 54px; gap: 6px; }
  .touch .slot { width: 54px; height: 54px; }
  .touch #joy { width: 124px; height: 124px; bottom: 12px; }
  .touch #chatBtn { left: 148px; bottom: 12px; }
  .touch #log, .touch #log.net { bottom: 142px; }
  #select h1 { font-size: 26px; } .sel-inner { padding: 8px 0 14px; }
  .card canvas { width: 70px; height: 76px; }
}
@media (orientation: portrait) and (max-width: 600px) {
  .touch #rotate { display: block; left: 50%; top: 118px; transform: translateX(-50%); z-index: 8; padding: 6px 14px; border-radius: 16px; pointer-events: none; white-space: nowrap;
    background: rgba(10, 6, 4, .85); border: 1px solid var(--line); color: #ffe9b0; font-size: 12px; animation: toast 8s forwards; }
}

.touch body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.touch input { -webkit-user-select: text; user-select: text; }
.slot.tap { filter: brightness(1.5); transform: scale(.93); }
.cell.sel, .eq.sel { outline: 2px solid #ffd23f; outline-offset: 1px; }
.bagsel { margin-top: 8px; padding: 9px 12px; border: 1px solid var(--rc); border-radius: 8px; background: rgba(0, 0, 0, .35); font-size: 13px; }
.bagsel p { margin: 2px 0; } .bagsel .dbtn { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.touch #pframe { left: max(6px, env(safe-area-inset-left)); } .touch #rightcol { right: max(6px, env(safe-area-inset-right)); }
.touch #log, .touch #log.net { left: max(8px, env(safe-area-inset-left)); }
.touch .pconly, .touch .help .hrow.pconly { display: none; }
.touch .bag { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; }
.touch .eqrow { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.touch .pb { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }
.bagsel { display: flex; align-items: center; gap: 12px; } .bagsel .bsi { flex: 1; min-width: 0; }
.bagsel .dbtn { flex-direction: column; flex-wrap: nowrap; margin-top: 0; } .bagsel .dbtn button { white-space: nowrap; }
/* Nút chat nằm ngay dưới nút bảng chức năng để không đè lên cụm nút chưởng */
.touch #chatBtn { left: auto; bottom: auto; right: 176px; top: 50px; }
@media (max-width: 700px) { .touch #chatBtn { right: 144px; } }
@media (orientation: portrait) {
  .touch #log, .touch #log.net { bottom: 208px; }
  .touch #rotate { top: 300px; }
}

/* ================= Khinh công, cử chỉ ================= */
#emoBar { right: 156px; bottom: 12px; display: flex; flex-direction: column; gap: 5px; pointer-events: auto; z-index: 12; }
#emoBar button { padding: 6px 12px; border-radius: 6px; background: var(--pan); border: 2px solid var(--line); color: var(--gold); font-size: 13px; text-align: left; white-space: nowrap; }
#emoBar button:hover { border-color: var(--gold); }
.touch #emoBar { right: 336px; top: 50px; bottom: auto; }
.touch #emoBar button { padding: 9px 14px; font-size: 14px; }
.touch #skillbar { grid-template-columns: repeat(4, 58px); }
.touch #slot_auto { grid-area: 1 / 2; } .touch #slot_hp { grid-area: 1 / 3; } .touch #slot_mp { grid-area: 1 / 4; }
.touch #slot_s2 { grid-area: 2 / 2; } .touch #slot_s3 { grid-area: 2 / 3; } .touch #slot_s4 { grid-area: 2 / 4; }
.touch #slot_leap { grid-area: 3 / 1; } .touch #slot_s0 { grid-area: 3 / 2; } .touch #slot_s1 { grid-area: 3 / 3; } .touch #slot_basic { grid-area: 3 / 4; }
.touch #slot_leap { border-color: #9be7ff; }
@media (max-height: 460px) { .touch #skillbar { grid-template-columns: repeat(4, 54px); } }
@media (orientation: portrait) {
  .touch #skillbar { grid-template-columns: repeat(4, 52px); grid-auto-rows: 52px; gap: 6px; }
  .touch .slot { width: 52px; height: 52px; }
  .touch #joy { width: 124px; height: 124px; }
  .touch #emoBar { right: 144px; top: 94px; }
}
@media (max-width: 700px) { .touch #emoBar { right: 144px; top: 94px; } }

/* ================= Giang hồ: tổ đội, bang hội, xếp hạng, hoạt động ================= */
.tabs { display: flex; gap: 4px; padding: 8px 10px 0; }
.tabs button { flex: 1; padding: 6px 4px; border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; background: rgba(0, 0, 0, .3); color: var(--mut); font-size: 13px; font-weight: 600; }
.tabs button.on { background: linear-gradient(180deg, #6a3a1e, #3a1d10); color: var(--gold); border-color: var(--gold2); }
.srow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid rgba(255, 255, 255, .07); }
.srow b { display: block; font-size: 13.5px; } .srow small { display: block; font-size: 11.5px; color: var(--mut); line-height: 1.35; }
.srow .abtn { display: flex; align-items: center; gap: 6px; flex: none; }
.frow { display: flex; gap: 6px; margin: 4px 0 8px; }
.frow input { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); background: rgba(0, 0, 0, .4); color: var(--txt); font-size: 13px; }
.note { margin: 4px 0 8px; padding: 6px 9px; border-left: 3px solid var(--gold2); background: rgba(0, 0, 0, .28); font-size: 12.5px; }
.cirow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 8px; }
.ci { padding: 5px 2px; border: 1px solid var(--line); border-radius: 6px; text-align: center; font-size: 10.5px; line-height: 1.3; background: rgba(0, 0, 0, .3); color: var(--mut); }
.ci b { display: block; font-size: 11.5px; color: var(--txt); } .ci span { display: block; }
.ci.got { opacity: .45; } .ci.got b::after { content: ' ✓'; color: #6dff8a; }
.ci.now { border-color: #ffd23f; box-shadow: 0 0 10px rgba(255, 210, 63, .45); color: #ffe9b0; }
.rrow { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 4px 0; font-size: 13px; border-top: 1px solid rgba(255, 255, 255, .06); }
.rrow i { font-style: normal; font-weight: 800; color: var(--gold); text-align: center; } .rrow span { color: var(--mut); font-size: 12px; }
.rrow:nth-of-type(1) i { color: #ffd23f; }
#partyBox { left: 14px; top: 98px; width: 170px; display: flex; flex-direction: column; gap: 4px; }
.pm { padding: 4px 7px 5px; border-radius: 6px; background: rgba(12, 7, 4, .72); border: 1px solid var(--line); font-size: 12px; }
.pm b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.pmbar { height: 5px; margin-top: 3px; border-radius: 3px; background: #1a0c08; overflow: hidden; } .pmbar div { height: 100%; width: 100%; background: linear-gradient(180deg, #5fe07a, #2a9a45); }
#invite { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 35; width: min(360px, 90vw); padding: 14px 18px; text-align: center; border-radius: 8px; background: var(--pan); border: 2px solid var(--gold2); box-shadow: 0 10px 30px rgba(0, 0, 0, .6); }
#invite p { margin: 0 0 12px; font-size: 14.5px; color: #ffe9b0; } #invite .dbtn { display: flex; justify-content: center; gap: 10px; }
#invite button { padding: 6px 18px; border-radius: 6px; border: 1px solid var(--gold2); background: linear-gradient(180deg, #6a3a1e, #3a1d10); color: var(--gold); font-weight: 600; font-size: 13.5px; }
#invite button.ghost { background: none; border-color: var(--line); color: var(--mut); }
#chatBox { display: flex; gap: 4px; } #chatBox.hidden { display: none !important; }
#chatChan { flex: none; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); background: rgba(12, 7, 4, .8); color: #cfe9ff; font-size: 12px; font-weight: 600; }
#chatChan[data-c="p"] { color: #8dffa6; } #chatChan[data-c="g"] { color: #ffcf6b; } #chatChan[data-c="n"] { color: #c9c9c9; }
#chatBox input { flex: 1; min-width: 0; }
#log div.cp { color: #b9ffc8; } #log div.cg { color: #ffe2a8; } #log div.cn { color: #d0d0d0; } #log div.cs { color: #ffe9b0; }
.touch #partyBox { left: max(6px, env(safe-area-inset-left)); top: 78px; width: 150px; }
.touch #chatBox.open { display: flex; }
.touch #chatChan { font-size: 14px; padding: 0 10px; }
.touch .tabs button { padding: 9px 4px; font-size: 14px; } .touch .frow input { height: 40px; font-size: 16px; }
.touch #invite button { padding: 10px 22px; font-size: 15px; }
@media (max-width: 700px) { .cirow { grid-template-columns: repeat(4, 1fr); } }

/* ================= Bản đồ lớn, dịch trạm, việc phụ ================= */
#mapbox { pointer-events: auto; cursor: pointer; }
#mapbox.big { position: fixed; right: 12px; top: 12px; z-index: 30; box-shadow: 0 16px 50px rgba(0, 0, 0, .7); }
#mapbox.big #minimap { width: min(900px, 86vw); height: auto; aspect-ratio: 428 / 200; image-rendering: auto; }
.touch #mapbox.big #minimap { width: 92vw; }
#quest p.side { margin-top: 6px; padding-top: 5px; border-top: 1px solid rgba(255, 255, 255, .12); color: #ffe2a8; font-size: 12.5px; }
#quest p.side b { font-size: 12.5px; }
#dialog { max-height: 78vh; overflow: auto; }
#dialog .dbtn { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.touch #quest p.side { margin-top: 3px; padding-top: 3px; font-size: 11px; } .touch #quest p.side .mob { display: none; } .touch #quest p.side b { font-size: 11px; }

/* Bản đồ nhỏ tự giữ tỉ lệ của thế giới (chiều cao tính theo aspect-ratio do mã đặt) */
#minimap { height: auto; aspect-ratio: 214 / 143; }
.touch #minimap { height: auto; }
#mapbox.big #minimap { width: min(820px, 80vw, 118vh); }
.touch #mapbox.big #minimap { width: min(92vw, 125vh); }

/* ================= Biểu tượng vẽ tay (gói A), cưỡi ngựa (gói C) ================= */
.ibox { position: relative; display: grid; place-items: center; }
.cell .ibox { position: absolute; inset: 3px; border-radius: 4px; overflow: hidden; }
.cell .ibox .ii, .eic.ibox .ii { object-fit: cover; padding: 0; background: none; }
.eic.ibox { width: 30px; height: 30px; border-radius: 5px; overflow: hidden; flex: none; }
.mi { width: 20px; height: 20px; object-fit: contain; flex: none; margin-right: 6px; vertical-align: -4px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .6)); }
#menu button .mi { margin-right: 0; order: -1; } #menu button { justify-content: flex-start; } #menu button kbd { margin-left: auto; }
.tabs button .mi, #emoBar button .mi { width: 17px; height: 17px; }
.touch #slot_mount { grid-area: 1 / 1; } .slot#slot_mount.active { border-color: #ffd23f; box-shadow: 0 0 12px rgba(255, 210, 63, .6); }

/* ================= Ba đợt tính năng mới: tân thủ, rương, bản đồ thế giới, sự nghiệp, chợ, giao dịch ================= */
#tutBox { left: 50%; top: 64px; transform: translateX(-50%); max-width: min(620px, 70vw); display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 8px; pointer-events: auto;
  background: rgba(14, 26, 38, .88); border: 2px solid #5ab8d8; box-shadow: 0 0 14px rgba(90, 184, 216, .35); font-size: 13.5px; color: #e8f6ff; }
#tutBox.hidden { display: none; } #tutBox b { color: #9be7ff; margin-right: 6px; } #tutBox i { font-style: normal; color: #ffd23f; font-weight: 700; }
#tutBox button { flex: none; padding: 3px 9px; border-radius: 5px; border: 1px solid #5ab8d8; background: none; color: #9be7ff; font-size: 12px; }
.tutglow { animation: tutglow 1s infinite; z-index: 3; }
@keyframes tutglow { 0%, 100% { box-shadow: 0 0 0 2px #ffd23f, 0 0 16px 4px rgba(255, 210, 63, .7); } 50% { box-shadow: 0 0 0 2px #fff, 0 0 26px 10px rgba(255, 210, 63, .9); } }
#quest { pointer-events: auto; cursor: pointer; } #quest:hover { filter: brightness(1.15); }
.panel.wide { width: min(1220px, calc(100vw - 24px)); top: 60px; max-height: calc(100vh - 80px); }
#mapCanvas { width: 100%; height: auto; display: block; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; }
#pKho, #pThem, #pCho, #pTrade { width: 460px; }
.srow small.tl { margin-top: 3px; } .srow small.tl button { padding: 1px 7px; margin: 1px 2px 1px 0; border-radius: 10px; border: 1px solid var(--gold2); background: rgba(0, 0, 0, .3); color: #ffe9b0; font-size: 11px; }
.srow small.tl button.on { background: linear-gradient(180deg, #8a6a1e, #5a3d10); color: #fff; border-color: #ffd23f; }
.panel [data-them] { cursor: pointer; }
.panel button[data-them] { border: 1px solid var(--gold2); border-radius: 6px; background: linear-gradient(180deg, #6a3a1e, #3a1d10); color: var(--gold); padding: 4px 10px; font-weight: 600; font-size: 13px; }
.panel button[data-them]:hover { filter: brightness(1.3); } .panel button[data-them].on { border-color: #ffd23f; color: #fff; } .panel button[data-them].ghost { background: none; border-color: var(--line); color: var(--mut); }
.panel .tabs button[data-them] { border-bottom: 0; border-radius: 6px 6px 0 0; background: rgba(0, 0, 0, .3); color: var(--mut); border-color: var(--line); padding: 6px 4px; }
.panel .tabs button[data-them].on { background: linear-gradient(180deg, #6a3a1e, #3a1d10); color: var(--gold); border-color: var(--gold2); }
#pThem .tabs button { font-size: 12.5px; }
.touch #tutBox { top: 82px; max-width: 76vw; font-size: 12px; padding: 5px 9px; }
.touch #pKho, .touch #pThem, .touch #pCho, .touch #pTrade { width: auto; }
.touch .panel button[data-them] { padding: 9px 12px; font-size: 14px; }

/* ---------- Chiến sự: nút Khu PK và Chiến sự dưới bản đồ nhỏ, khung tỉ số giữa màn hình, bảng Võ công 100 cấp ---------- */
#khuBtns { display: flex; gap: 5px; pointer-events: auto; }
#khuBtns button { flex: 1; padding: 5px 4px; border-radius: 6px; border: 2px solid var(--line); background: var(--pan); color: #ffe9b0; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
#khuBtns button:hover { border-color: var(--gold); }
#khuBtns #btnPk { color: #ff9c8a; } #khuBtns #btnPk.on { background: linear-gradient(180deg, #8f261b, #55120c); border-color: #ff6b5c; color: #fff; }
#khuBtns button.pulse { border-color: #c77dff; animation: pulse 1.1s infinite; }
#khuBtns kbd { font-size: 10px; min-width: 14px; padding: 0 3px; }
#khuBox { left: 50%; top: 108px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: min(760px, 78vw); padding: 6px 12px; border-radius: 8px; pointer-events: auto;
  background: rgba(20, 10, 8, .9); border: 1px solid #a8483e; color: #f1e3b5; font-size: 13.5px; z-index: 8; }
#khuBox.hidden { display: none; } #khuBox i { font-style: normal; } #khuBox b { color: #ffd86b; }
#khuBox button { flex: none; padding: 3px 10px; border-radius: 5px; border: 1px solid #ff9c8a; background: none; color: #ff9c8a; font-size: 12.5px; }
#khuBox button:hover { background: #55120c; color: #fff; }
#chienTabs { grid-template-columns: repeat(4, 1fr); }
#pChien h4 { margin: 10px 0 4px; } #pChien p { margin: 4px 0; font-size: 13px; line-height: 1.45; }
#mapQuick { margin: 6px 0 2px; }
.skbtn { display: flex; flex-direction: column; gap: 4px; flex: none; } .skbtn button { min-width: 92px; padding: 4px 6px; font-size: 12px; }
#pSkill .dbtn button.on { border-color: var(--gold); color: var(--gold); }
#btnKhuOut { margin-top: 8px; } #btnKhuOut.hidden { display: none; } #btnRevive:disabled { opacity: .55; }
.touch #khuBtns button { padding: 6px 2px; font-size: 11.5px; } .touch #khuBox { top: 50px; font-size: 11.5px; padding: 4px 8px; gap: 6px; max-width: 62vw; }
#chienTabs button { height: 34px; padding: 0 2px; font-size: 13px; white-space: nowrap; }
#pChien .dbtn button, #mapQuick button, #pSkill .dbtn button, #pChien .abtn button, .skbtn button { padding: 6px 12px; border-radius: 6px; border: 2px solid var(--line); background: #1a0d08; color: #ffe9b0; font-weight: 600; font-size: 13px; }
#pChien .dbtn button:hover, #mapQuick button:hover, #pSkill .dbtn button:hover, .skbtn button:hover { border-color: var(--gold); }
#pChien .dbtn button { background: linear-gradient(180deg, #8f261b, #55120c); border-color: var(--gold2); color: #fff; padding: 8px 18px; font-size: 14px; }
#pChien button:disabled, .skbtn button:disabled, #mapQuick button:disabled { opacity: .45; cursor: default; }
#pChien .abtn { align-items: center; } #pChien .abtn span { font-size: 12.5px; color: #ffd86b; white-space: nowrap; }
#pChien .srow small { display: block; font-size: 12px; color: var(--mut); }
.skbtn button { min-width: 92px; padding: 4px 6px; font-size: 12px; }
#khuBtns button { display: flex; align-items: center; justify-content: center; gap: 4px; } #khuBtns b { font-weight: 400; }
/* Điện thoại: hai nút chiến sự thành hai ô vuông xếp dưới nút menu và nút chat, để khung nhiệm vụ không bị đẩy xuống đè lên nút chưởng */
.touch #rightcol > #khuBtns { position: fixed; right: 176px; top: 94px; width: 38px; flex-direction: column; gap: 6px; }
.touch #khuBtns button { width: 38px; height: 38px; padding: 0; border-radius: 8px; font-size: 17px; } .touch #khuBtns span { display: none; }
@media (max-width: 700px) { .touch #rightcol > #khuBtns { right: 144px; } }
/* ---------- Ảnh đợt 4: chân dung trong hội thoại, ảnh xem trước lễ phục, biểu tượng trên tiêu đề bảng ---------- */
.dport { float: right; height: 190px; margin: -6px -4px 6px 10px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .55)); pointer-events: none; }
.ttbox { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; } .ttbox > div { flex: 1; } .ttbox img { height: 200px; flex: none; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .55)); pointer-events: none; }
.ph span .mi { width: 22px; height: 22px; vertical-align: -5px; } .srow b .mi { width: 26px; height: 26px; vertical-align: -7px; } .rrow span .mi { width: 18px; height: 18px; margin-right: 4px; }
.touch .dport { height: 130px; } .touch .ttbox img { height: 140px; }
#khuBtns b .mi { width: 18px; height: 18px; margin-right: 0; vertical-align: -4px; } .skinfo em .mi { width: 22px; height: 22px; vertical-align: -6px; margin-right: 4px; }
#pChien p .mi { width: 22px; height: 22px; vertical-align: -6px; } #pChien h4 .mi { width: 24px; height: 24px; vertical-align: -6px; }
#quest h5 .mi { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; } #tutBox .mi { width: 22px; height: 22px; margin-right: 6px; vertical-align: -5px; } #pThem p .mi { width: 20px; height: 20px; vertical-align: -5px; }

/* ---------- Nâng cấp toàn diện (js/moi.js): bảng Thiên Hạ, khung trạng thái, nút ống kính, túi đồ rộng ---------- */
.panel.wide2 { width: min(860px, calc(100vw - 24px)); top: 70px; max-height: calc(100vh - 170px); }
.tabs.t7 { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.tabs button.hidden { display: none; }
#lcBox { margin-top: 3px; font-size: 12.5px; color: #ffcf8a; font-weight: 700; cursor: pointer; }
#lcBox .mailb { color: #9be7ff; animation: npthBlink 1.2s infinite; } #lcBox .evb { color: #ffb3d9; }
@keyframes npthBlink { 50% { opacity: .35; } }
#zoomBtns { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; font-size: 12px; }
#zoomBtns button { width: 30px; height: 24px; border-radius: 6px; border: 1px solid var(--gold2, #a8873f); background: #1a1c24; color: var(--gold, #ffd86b); font-size: 17px; line-height: 1; cursor: pointer; pointer-events: auto; }
#zoomBtns button:hover { filter: brightness(1.4); }
#moiHud { position: fixed; left: 50%; top: 150px; transform: translateX(-50%); z-index: 8; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
#moiHud .mh { pointer-events: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; max-width: min(640px, 86vw); padding: 6px 12px; border-radius: 9px;
  background: rgba(14, 12, 10, .82); border: 1px solid #a8873f; color: #f1e3b5; font-size: 13px; box-shadow: 0 6px 18px rgba(0, 0, 0, .5); }
#moiHud .mh b { color: #ffd86b; } #moiHud .mh small { width: 100%; text-align: center; color: #cfc7b0; font-size: 11.5px; }
#moiHud .mh.wb { border-color: #ff4f6d; } #moiHud .mh.hi { border-color: #ffb347; } #moiHud .mh.ctl { border-color: #ffd23f; } #moiHud .mh.tn { border-color: #7dffe0; }
#moiHud button, #pMoi button[data-moi] { border: 1px solid var(--gold2, #a8873f); border-radius: 6px; background: linear-gradient(180deg, #6a3a1e, #3a1d10); color: var(--gold, #ffd86b); padding: 4px 10px; font-weight: 600; font-size: 12.5px; cursor: pointer; }
#pMoi button[data-moi]:hover, #moiHud button:hover { filter: brightness(1.3); }
#pMoi button[data-moi].on { background: linear-gradient(180deg, #8f261b, #55120c); color: #fff; }
#pMoi .tabs button[data-moi] { background: #1a0d08; height: 36px; }
#pMoi .tabs button[data-moi].on { background: linear-gradient(180deg, #8f261b, #55120c); }
#pMoi .srow { align-items: center; } #pMoi .srow > div:first-child { flex: 1; min-width: 0; } #pMoi .srow small { display: block; color: #bfb59a; font-size: 12px; margin-top: 1px; }
#pMoi .abtn { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; max-width: 55%; }
#pMoi input, #pMoi select { background: #120c08; border: 1px solid #5a4320; color: #f1e3b5; border-radius: 6px; padding: 5px 8px; font-size: 13px; }
#pMoi .dbtn { align-items: center; }
.lcbig { font-size: 15px; padding: 8px 10px; border-radius: 8px; background: linear-gradient(90deg, rgba(255, 140, 40, .18), rgba(0, 0, 0, 0)); color: #ffcf8a; }
.aurabar { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; margin: 6px 0 4px; } .aurabar i { height: 12px; border-radius: 3px; }
.mat { display: inline-block; margin: 2px 8px 2px 0; padding: 2px 7px; border-radius: 6px; background: rgba(255, 255, 255, .06); font-size: 12.5px; } .mat b { color: #7dffe0; }
.rk3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.rk3 > div { padding: 6px 8px; border-radius: 8px; background: rgba(0, 0, 0, .25); } .rk3 p { margin: 2px 0; font-size: 12.5px; display: flex; gap: 6px; }
.rk3 p i { font-style: normal; color: #ffd86b; width: 18px; } .rk3 p span { margin-left: auto; color: #cfc7b0; }
.ahrow { align-items: center !important; } .ahic { width: 38px; height: 38px; border: 1px solid var(--rc); border-radius: 6px; overflow: hidden; flex: none; }
/* Túi đồ và rương rộng: hai cột, ô đồ có tên */
.bagwrap { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }
.bagwrap .eqrow { grid-template-columns: 1fr; }
.eq .en small { display: block; font-weight: 400; color: #bfb59a; font-size: 11px; }
.bagst { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; margin: 8px 0; padding: 7px 9px; border-radius: 8px; background: rgba(0, 0, 0, .3); font-size: 12.5px; color: #cfc7b0; }
.bagst b { color: #fff; } .bagst .lc { grid-column: 1 / -1; color: #ffcf8a; }
.bag.big { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.cell.named { aspect-ratio: auto; height: 92px; }
.cell.named .ibox { inset: 4px 4px auto 4px; height: 52px; }
.cell.named em { position: absolute; left: 3px; right: 3px; bottom: 3px; font: 600 10.5px/1.15 -apple-system, Arial, sans-serif; color: var(--rc); text-align: center; font-style: normal;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 2px #000; }
.cell.named i { top: 3px; bottom: auto; }
.cell.selling { outline: 1px dashed #ff7b7b; } .cell.selling:hover { background: #4a1010; }
.khobar { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 6px; font-size: 12.5px; }
.khobar button, .sellr button, #pKho .dbtn button { border: 1px solid var(--gold2, #a8873f); border-radius: 6px; background: linear-gradient(180deg, #3a3524, #25221a); padding: 4px 9px; font-weight: 600; font-size: 12px; cursor: pointer; color: var(--gold, #ffd86b); }
.khobar button.on { background: #7a1c12; color: #fff; }
.sellr { margin-top: 8px; }
.bagr .bagfoot { margin-top: 0; }
@media (max-width: 760px) { .bagwrap { grid-template-columns: 1fr; } .bag.big { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); } .cell.named { height: 80px; } .cell.named .ibox { height: 42px; } }
.touch #moiHud { top: 92px; } .touch #moiHud .mh { font-size: 11.5px; padding: 4px 8px; }
.touch #zoomBtns button { width: 34px; height: 28px; }

/* Khung trò chuyện với NPC AI */
#aiBox { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); z-index: 12; display: flex; flex-direction: column;
  background: rgba(20, 12, 8, .95); border: 1px solid #a8873f; border-radius: 10px; box-shadow: 0 12px 40px rgba(0, 0, 0, .6); pointer-events: auto; }
#aiBox.hidden { display: none; }
#aiBox .aih { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid #4a3320; color: #ffd86b; }
#aiBox .aih button { background: none; border: 0; color: #cfc7b0; font-size: 16px; cursor: pointer; }
#aiLog { max-height: 240px; overflow-y: auto; padding: 8px 12px; font-size: 13.5px; line-height: 1.45; color: #f1e3b5; }
#aiLog p { margin: 0 0 7px; } #aiLog p b { color: #ffd86b; } #aiLog p.me b { color: #9be7ff; } #aiLog p.wait { color: #8a8070; letter-spacing: 3px; }
#aiBox .aif { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid #4a3320; }
#aiIn { flex: 1; background: #120c08; border: 1px solid #5a4320; color: #f1e3b5; border-radius: 6px; padding: 7px 9px; font-size: 13.5px; }
#aiSend { border: 1px solid #a8873f; border-radius: 6px; background: linear-gradient(180deg, #6a3a1e, #3a1d10); color: #ffd86b; padding: 0 14px; font-weight: 600; cursor: pointer; }

/* Chế độ khán giả cho livestream (?xem=1) */
.spec #hud, .spec #select, .spec #joy, .spec #menuBtn, .spec #chatBtn, .spec #aiBox, .spec #moiHud { display: none !important; }
#specBar { position: fixed; inset: 0; pointer-events: none; z-index: 20; font-family: inherit; }
#specBar.hidden { display: none; }
#specBar .sp-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 14px; padding: 10px 18px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .75), rgba(0, 0, 0, 0)); color: #f1e3b5; font-size: 15px; }
#specBar .sp-top b { color: #ffd86b; letter-spacing: 3px; font-size: 18px; } #specBar .live { color: #fff; background: #d6202e; padding: 2px 9px; border-radius: 4px; font-weight: 800; font-size: 13px; }
#specTitle { position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%); padding: 9px 22px; border-radius: 10px; background: rgba(20, 10, 8, .82); border: 1px solid #a8873f;
  color: #ffd86b; font-size: 22px; font-weight: 800; text-shadow: 0 2px 4px #000; white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis; }
#specSide { position: absolute; right: 14px; top: 60px; width: 250px; display: flex; flex-direction: column; gap: 5px; pointer-events: auto; }
#specSide h5 { margin: 6px 0 2px; color: #ffd86b; font-size: 12px; letter-spacing: 1px; text-shadow: 0 1px 3px #000; }
#specSide button { text-align: left; padding: 6px 9px; border-radius: 7px; border: 1px solid #5a4320; background: rgba(20, 12, 8, .8); color: #f1e3b5; font-size: 12.5px; cursor: pointer; }
#specSide button.on { border-color: #ffd86b; background: rgba(110, 30, 18, .9); color: #fff; }
#specChat { position: absolute; left: 14px; bottom: 100px; width: min(420px, 60vw); font-size: 13px; color: #f1e3b5; text-shadow: 0 1px 3px #000; }
#specChat p { margin: 3px 0; background: rgba(0, 0, 0, .45); padding: 3px 8px; border-radius: 5px; } #specChat b { color: #ffd86b; }

/* Đoạn phim kể chuyện */
#csBox { position: fixed; inset: 0; z-index: 25; pointer-events: auto; cursor: pointer; }
#csBox.hidden { display: none; }
#csBox .cs-bar { position: absolute; left: 0; right: 0; top: 0; height: 11vh; background: #000; animation: csIn .5s ease-out; }
#csBox .cs-bar.bot { top: auto; bottom: 0; height: 26vh; }
@keyframes csIn { from { transform: scaleY(0); } }
#csBox .cs-txt { position: absolute; left: 50%; bottom: 4vh; transform: translateX(-50%); width: min(820px, 90vw); color: #f1e3b5; text-align: center; }
#csBox .cs-txt b { display: block; color: #ffd86b; font-size: 19px; letter-spacing: 2px; margin-bottom: 6px; }
#csBox .cs-txt p { font-size: 18px; line-height: 1.5; min-height: 54px; margin: 0 0 8px; }
#csBox .cs-txt small { color: #8a8070; font-size: 12px; }

/* Thanh Nộ */
#noBar { position: relative; height: 12px; margin: 3px 0 2px; border-radius: 6px; background: rgba(0, 0, 0, .6); border: 1px solid #6a2a10; overflow: hidden; cursor: pointer; pointer-events: auto; }
#noBar.hidden { display: none; }
#noFill { height: 100%; width: 0; background: linear-gradient(90deg, #ff6a1f, #ffd23f); transition: width .2s; }
#noBar span { position: absolute; inset: 0; text-align: center; font: 800 9.5px/12px -apple-system, Arial, sans-serif; color: #fff; text-shadow: 0 1px 2px #000; letter-spacing: 1px; }
#noBar.full { border-color: #ffd23f; box-shadow: 0 0 10px #ffb000; animation: npthBlink .8s infinite; }

.chat.cvip { background: linear-gradient(90deg, rgba(255, 200, 60, .22), rgba(0, 0, 0, 0)); border-left: 2px solid #ffd23f; padding-left: 5px; }

/* Thanh chỉnh âm lượng */
.volrow { display: grid; grid-template-columns: 170px 1fr 46px; align-items: center; gap: 10px; margin: 6px 0; font-size: 13px; }
.volrow input { width: 100%; accent-color: #ffb347; } .volrow b { color: #ffd86b; text-align: right; }
/* ---------- Điện thoại: bảng to toàn màn hình, nút bấm lớn, không bôi đen chữ khi giữ tay ---------- */
.touch body, .touch #hud { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.touch .panel.wide2 { left: 2vw; right: 2vw; top: max(6px, env(safe-area-inset-top)); width: auto; max-height: calc(100dvh - 12px); }
.touch #pMoi .tabs button[data-moi] { height: 40px; font-size: 13px; }
.touch #pMoi button[data-moi], .touch #moiHud button { padding: 9px 13px; font-size: 14px; min-height: 40px; }
.touch #pMoi .srow { flex-wrap: wrap; } .touch #pMoi .abtn { max-width: 100%; width: 100%; justify-content: flex-start; margin-top: 4px; }
.touch #pMoi input, .touch #pMoi select { font-size: 16px; padding: 8px; } /* chữ 16px để iPhone không tự phóng to trang khi gõ */
.touch #aiIn { font-size: 16px; }
.touch .volrow { grid-template-columns: 1fr 1.2fr 42px; }
.touch #noBar { height: 18px; margin: 4px 0; } .touch #noBar span { line-height: 18px; font-size: 11px; }
.touch #zoomBtns { margin-top: 2px; } .touch #lcBox { font-size: 11px; }
.touch #moiHud { top: max(86px, calc(env(safe-area-inset-top) + 80px)); max-width: 70vw; }
.touch .bagwrap { grid-template-columns: 1fr; }
.touch #specSide { width: 180px; }
@media (orientation: landscape) and (max-height: 500px) {
  .touch #moiHud { top: 54px; } .touch #moiHud .mh { padding: 3px 8px; }
  .touch .panel.wide2 { top: 4px; max-height: calc(100dvh - 8px); }
  .touch #csBox .cs-bar.bot { height: 34vh; } .touch #csBox .cs-txt p { font-size: 15px; min-height: 40px; }
}

/* =====================================================================
   GIAO DIỆN ĐẲNG CẤP GAME ONLINE: phông Noto Serif cho tiêu đề, khung sơn son thếp vàng hai lớp viền,
   tiêu đề bảng có hoa văn, nút ánh kim, thanh cuộn vàng, hàng biểu tượng hoạt động, thông báo kiểu thư pháp
   ===================================================================== */
:root { --serif: "Noto Serif", "Times New Roman", Georgia, serif; --gold3: #ffe9a8;
  --pan: linear-gradient(180deg, rgba(62, 30, 18, .96), rgba(26, 12, 8, .97)),
    repeating-linear-gradient(45deg, rgba(255, 220, 150, .025) 0 2px, transparent 2px 9px); }
.ph, #zoneLabel, #pName, .bt, #quest b, #select h1, .cname, #specTitle, .lcbig, #pMoi h4, .panel h4, #dialog h3, #aiName, #csWho { font-family: var(--serif) !important; }
#pframe, #tframe, #mapbox, #quest, #skillbar, .panel, #dialog, .dbox, #authBox, #charBox {
  border: 2px solid #c9a24a; border-radius: 8px;
  box-shadow: 0 0 0 2px #2a1206, 0 0 0 3px #7a5a22, inset 0 0 0 1px rgba(255, 233, 168, .22), inset 0 0 30px rgba(0, 0, 0, .45), 0 10px 28px rgba(0, 0, 0, .6); }
.ph { background: linear-gradient(180deg, #a8301f 0%, #6e180f 55%, #4a0f09 100%); border-bottom: 2px solid #e0b85a; text-shadow: 0 2px 2px #2a0806, 0 0 12px rgba(255, 200, 100, .35); letter-spacing: 3px; font-weight: 700; }
.ph::before, .ph::after { content: ''; position: absolute; top: 50%; width: 70px; height: 2px; background: linear-gradient(90deg, transparent, #f0cf78); transform: translateY(-50%); }
.ph::before { left: 16px; } .ph::after { right: 44px; transform: translateY(-50%) scaleX(-1); }
.ph > span { position: relative; padding: 0 18px; }
.ph > span::before, .ph > span::after { content: '◆'; position: absolute; top: 50%; transform: translateY(-50%); font-size: 9px; color: #f0cf78; }
.ph > span::before { left: 0; } .ph > span::after { right: 0; }
.panel h4, #pMoi h4 { color: #f6dc8e; letter-spacing: 1px; margin: 12px 0 6px; padding-bottom: 4px; border-bottom: 1px solid rgba(201, 162, 74, .35); background: linear-gradient(90deg, rgba(201, 162, 74, .14), transparent 70%); padding-left: 6px; }
.panel button[data-act], #dialog button, #pMoi button[data-moi], #moiHud button, .khobar button, .sellr button, .panel button[data-them], .panel button[data-chien] {
  position: relative; overflow: hidden; border: 1px solid #e0b85a !important; border-radius: 6px; color: #fff3cf !important; text-shadow: 0 1px 1px #3a1206;
  background: linear-gradient(180deg, #b0452a 0%, #7a2214 50%, #4e140b 100%) !important; box-shadow: inset 0 1px 0 rgba(255, 220, 170, .35), 0 2px 4px rgba(0, 0, 0, .5); transition: filter .12s, transform .08s; }
.panel button[data-act]:hover, #dialog button:hover, #pMoi button[data-moi]:hover, #moiHud button:hover { filter: brightness(1.18) drop-shadow(0 0 6px rgba(255, 200, 100, .45)); }
.panel button:active, #pMoi button:active { transform: translateY(1px); }
.panel button[disabled], #pMoi button[disabled] { filter: grayscale(.8) brightness(.7) !important; }
#pMoi .tabs button[data-moi], .tabs button { background: linear-gradient(180deg, #2a160c, #160b06) !important; color: #cdb98a !important; border: 1px solid #6a4a1e !important; }
#pMoi .tabs button[data-moi].on, .tabs button.on { background: linear-gradient(180deg, #b0452a, #5a140b) !important; color: #fff3cf !important; border-color: #f0cf78 !important; box-shadow: 0 0 10px rgba(255, 190, 90, .35), inset 0 1px 0 rgba(255, 230, 180, .3); }
.pb::-webkit-scrollbar, #aiLog::-webkit-scrollbar { width: 8px; } .pb::-webkit-scrollbar-thumb, #aiLog::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #e0b85a, #8a6a2f); border-radius: 4px; }
.pb::-webkit-scrollbar-track { background: rgba(0, 0, 0, .3); }
/* Khung nhân vật: chân dung viền vàng phát sáng, cảnh giới và lực chiến dưới tên */
#portrait { border: 3px solid #e0b85a; box-shadow: 0 0 0 2px #2a1206, 0 0 0 4px #8a6a2f, 0 0 16px -2px var(--sect); }
#pRank { font-size: 11.5px; color: #e9dcb8; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.bar { border: 1px solid #8a6a2f; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .7); }
.bar .fill { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
#zoneLabel { font-weight: 700; text-shadow: 0 2px 2px #2a0a06, 0 0 10px rgba(240, 200, 110, .4); }
/* Thông báo lớn kiểu thư pháp: chữ vàng ánh kim, vệt mực đỏ phía sau */
.bt { font-weight: 800; background: linear-gradient(180deg, #fff6d0 0%, #f0cf78 45%, #b8862a 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #4a1a08) drop-shadow(0 0 18px rgba(255, 190, 80, .55)); }
#banner.show::before { content: ''; position: absolute; left: 50%; top: -10px; width: min(760px, 90vw); height: 92px; transform: translateX(-50%); z-index: -1;
  background: radial-gradient(ellipse at center, rgba(120, 20, 12, .78) 0%, rgba(80, 10, 6, .45) 45%, transparent 72%); }
#toast { border: 1px solid #c9a24a; background: linear-gradient(180deg, rgba(60, 28, 16, .95), rgba(24, 12, 8, .95)); box-shadow: 0 4px 14px rgba(0, 0, 0, .6); }
#quest h5 { color: #e0b85a; } #quest { background: linear-gradient(180deg, rgba(40, 20, 12, .9), rgba(20, 10, 8, .9)); }
.slot { transition: transform .08s, box-shadow .12s; } .slot:hover { box-shadow: 0 0 10px rgba(255, 200, 100, .55), inset 0 0 10px rgba(0, 0, 0, .6); }
#log { background: linear-gradient(90deg, rgba(10, 6, 4, .45), rgba(10, 6, 4, 0)); padding: 4px 8px; border-radius: 6px; }
/* Hàng biểu tượng hoạt động: nằm bên trái bản đồ nhỏ */
#hdTray { position: fixed; top: 12px; right: 258px; z-index: 6; display: flex; flex-direction: row-reverse; flex-wrap: wrap; gap: 8px 6px; max-width: min(520px, calc(100vw - 620px)); pointer-events: auto; }
#hdTray .hd { position: relative; width: 56px; padding: 0; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
#hdTray .hd i, #hdTray .hd .mi { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 22px;
  background: radial-gradient(circle at 35% 30%, #7a3a22, #2a1008 70%); border: 2px solid #e0b85a; box-shadow: 0 0 0 2px #2a1206, 0 3px 8px rgba(0, 0, 0, .6), inset 0 0 10px rgba(0, 0, 0, .6); transition: transform .1s, box-shadow .15s; }
#hdTray .hd .mi { position: static; object-fit: cover; padding: 0; }
#hdTray .hd:hover i, #hdTray .hd:hover .mi { transform: scale(1.08); box-shadow: 0 0 0 2px #2a1206, 0 0 14px rgba(255, 200, 100, .7); }
#hdTray .hd span { font: 700 10.5px var(--serif); color: #f6dc8e; text-shadow: 0 1px 2px #000, 0 0 4px #000; white-space: nowrap; }
#hdTray .hd em { position: absolute; top: -4px; right: -2px; min-width: 18px; padding: 1px 5px; border-radius: 9px; font: 800 9.5px/14px -apple-system, Arial, sans-serif; font-style: normal;
  color: #fff; background: #c0341d; border: 1px solid #ffd27a; box-shadow: 0 1px 3px #000; }
#hdTray .hd em.hot { background: #e8a020; color: #2a1206; animation: npthBlink 1s infinite; }
@media (max-width: 1100px) { #hdTray { right: 252px; max-width: calc(100vw - 600px); } }
.touch #hdTray { top: auto; bottom: calc(150px + env(safe-area-inset-bottom)); right: auto; left: max(8px, env(safe-area-inset-left)); flex-direction: column; flex-wrap: wrap; max-height: 46vh; max-width: none; gap: 4px; }
.touch #hdTray .hd { width: 44px; } .touch #hdTray .hd i, .touch #hdTray .hd .mi { width: 36px; height: 36px; font-size: 17px; } .touch #hdTray .hd span { font-size: 9px; }
@media (orientation: landscape) and (max-height: 500px) { .touch #hdTray { flex-direction: row; bottom: auto; top: 58px; left: 240px; max-width: calc(100vw - 480px); } .touch #hdTray .hd span { display: none; } }
.spec #hdTray { display: none; }

/* Máy tính màn thấp (laptop, cửa sổ Chrome còn thanh công cụ): menu phải xếp hai cột gọn ở góc dưới,
   không đè lên khung nhiệm vụ, nút Khu PK và nút phóng to bản đồ nhỏ */
@media (max-height: 900px) {
  html:not(.touch) #menu { display: grid; grid-template-columns: repeat(2, 98px); gap: 4px; }
  html:not(.touch) #menu button { width: auto; min-width: 0; padding: 4px 6px; gap: 4px; font-size: 12px; white-space: nowrap; }
  html:not(.touch) #menu button .mi { width: 16px; height: 16px; }
  html:not(.touch) #menu button kbd { font-size: 10px; min-width: 14px; padding: 0 3px; margin: 0; }
  html:not(.touch) #menu #mLogout { justify-content: center; }
  html:not(.touch) #quest { max-height: max(90px, calc(100vh - 520px)); overflow-y: auto; }
}
/* Màn vừa hẹp vừa thấp: bỏ chữ phím tắt cho menu hẹp lại, không che quả cầu nội lực */
@media (max-height: 900px) and (max-width: 1440px) {
  html:not(.touch) #menu { grid-template-columns: repeat(2, 78px); }
  html:not(.touch) #menu button { justify-content: center; }
  html:not(.touch) #menu button kbd { display: none; }
}
/* Nút ✕ tắt từng thông báo giữa màn hình (boss thế giới, công thành, thương nhân, áp tiêu, Đại Chiến) */
#moiHud .mh button.mhx, #khuBox button.mhx { flex: none; width: 24px; height: 24px; min-height: 0; padding: 0; margin-left: 2px; border-radius: 50%; border: 1px solid rgba(255, 220, 160, .45);
  background: rgba(0, 0, 0, .35); color: #e8dcc0; font-size: 13px; line-height: 22px; text-align: center; cursor: pointer; }
#moiHud .mh button.mhx:hover, #khuBox button.mhx:hover { background: #8a2a1a; color: #fff; filter: none; }
.touch #moiHud .mh button.mhx, .touch #khuBox button.mhx { width: 34px; height: 34px; min-height: 34px; padding: 0; font-size: 16px; line-height: 32px; }
