:root{--bg:#14110e;--panel:#1d1813;--panel2:#262018;--line:#3a3025;--text:#e8dcc4;--dim:#9a8d75;--gold:#d9a441;--red:#c0503c;--green:#6aa46a;--blue:#5b8fc7}
@media (prefers-color-scheme:light){:root{--bg:#f3ecdd;--panel:#fbf6ea;--panel2:#efe5cf;--line:#d4c6a6;--text:#2b241a;--dim:#7a6c52;--gold:#a56d12;--red:#a53a27;--green:#3f7a3f;--blue:#2f6aa6}}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--bg);color:var(--text);font:14px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif}
button,select,input{font:inherit;color:inherit;background:var(--panel2);border:1px solid var(--line);border-radius:6px;padding:5px 10px}
button{cursor:pointer}button:hover{border-color:var(--gold)}
#loader{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:16px;overflow:auto;background:radial-gradient(ellipse at 50% 30%,#2c2417 0%,#14110e 62%),#14110e}
#loader[hidden]{display:none}
.ld-card{width:min(520px,100%);box-sizing:border-box;margin:auto;padding:30px 30px 22px;text-align:center;background:rgba(10,18,16,.62);border:18px solid transparent;border-image:url(assets/ui/dlg-say.png) 16 fill/18px stretch;box-shadow:0 18px 60px rgba(0,0,0,.6)}
.ld-logo{font-size:34px;font-weight:800;letter-spacing:.5px;color:#f3e7c4;text-shadow:0 2px 0 #000,0 0 18px rgba(228,189,105,.35)}.ld-logo span{margin-left:8px;background:linear-gradient(180deg,#ffe9a8,#c9953a);-webkit-background-clip:text;background-clip:text;color:transparent;text-shadow:none}
#loader h1{font-size:16px;margin:6px 0 18px;font-weight:600;color:#cfe3cf}#loader small{display:block;margin-top:3px;color:var(--gold);font-weight:400;font-size:13px}
.bar{height:10px;background:rgba(0,0,0,.45);border:1px solid #7a6a3c;border-radius:6px;overflow:hidden;box-shadow:inset 0 1px 3px #000}
#bar-fill{height:100%;width:0;background:linear-gradient(90deg,#9a6a1c,#f0c860,#9a6a1c);background-size:200% 100%;animation:ld-shine 1.6s linear infinite;transition:width .25s;border-radius:5px}
@keyframes ld-shine{to{background-position:-200% 0}}
#loader-msg{margin:10px 0 4px;color:#d8cfae;font-size:14px;min-height:1.4em}
#loader-log{color:var(--dim);font-size:11px;white-space:pre-wrap;max-height:90px;overflow:auto;margin:6px 0 0;text-align:left}
#entry{display:flex;flex-direction:column;gap:6px;text-align:left;margin:12px 0 4px}#entry[hidden]{display:none}
#entry label{font-size:12px;color:#d9a441;letter-spacing:.4px;text-transform:uppercase;margin-top:6px}
#entry input{background:rgba(0,0,0,.4);border:1px solid #7a6a3c;border-radius:8px;color:#f3e7c4;padding:10px 12px;font-size:16px}
#entry input:focus{outline:none;border-color:#f0c860;box-shadow:0 0 0 2px rgba(240,200,96,.25)}#entry input:disabled{opacity:.65}
#entry button{margin-top:10px;padding:11px;border-radius:8px;border:1px solid #e4bd69;background:linear-gradient(180deg,#e9c46a,#a8741f);color:#2b1c05;font-weight:800;font-size:16px;cursor:pointer}
#entry button:disabled{filter:grayscale(.7) brightness(.8);cursor:wait}
.ent-note{margin:2px 0;color:#9fd3a0;font-size:13px;min-height:1.2em}.ent-err{margin:0;color:#ff8a76;font-size:13px;min-height:1.2em}.ent-fine{margin:4px 0 0;text-align:center;color:#8d8670;font-size:11px}
#app{display:flex;flex-direction:column;height:100%}
header{display:flex;align-items:center;gap:16px;padding:8px 16px;background:var(--panel);border-bottom:1px solid var(--line);flex-wrap:wrap}
.brand{font-weight:700;font-size:18px;letter-spacing:.5px}.brand span{color:var(--gold)}
#hud{flex:1;display:flex;gap:16px;color:var(--dim);flex-wrap:wrap}#hud b{color:var(--text);font-weight:600}
nav{display:flex;gap:6px;flex-wrap:wrap}
main{flex:1;display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:12px;padding:12px;min-height:0}
@media (max-width:900px){main{grid-template-columns:1fr;overflow:auto}}
section{background:var(--panel);border:1px solid var(--line);border-radius:10px;min-height:0;display:flex;flex-direction:column}
.toolbar{display:flex;gap:10px;align-items:center;padding:10px;border-bottom:1px solid var(--line);flex-wrap:wrap}
.toolbar select{max-width:260px}#map-info{color:var(--dim);margin-left:auto;font-size:12px}
.split{display:grid;grid-template-columns:minmax(0,1fr) 220px;flex:1;min-height:0}
@media (max-width:1100px){.split{grid-template-columns:1fr}}
#map{width:100%;height:100%;min-height:320px;background:var(--bg);cursor:crosshair;display:block}
#npc-list{list-style:none;margin:0;padding:6px;overflow:auto;border-left:1px solid var(--line);max-height:100%}
#npc-list li{padding:4px 8px;border-radius:6px;cursor:pointer;display:flex;justify-content:space-between;gap:8px}
#npc-list li:hover{background:var(--panel2)}#npc-list li small{color:var(--dim)}
#side{overflow:hidden}
#chat{flex:1;overflow:auto;padding:10px;font-size:13px;min-height:160px}
#chat div{padding:1px 0}.k-tip{color:var(--gold)}.k-world,.k-news{color:var(--red)}.k-npc{color:var(--green)}.k-err{color:var(--red)}.k-sys{color:var(--text)}.k-map,.k-mission,.k-team{color:var(--blue)}
#panel{border-top:1px solid var(--line);max-height:55%;overflow:auto;padding:10px;font-size:13px}
#panel table{width:100%;border-collapse:collapse}#panel td,#panel th{text-align:left;padding:2px 6px;border-bottom:1px solid var(--line)}
#panel textarea{width:100%;height:90px;background:var(--bg);color:var(--text);border:1px solid var(--line);border-radius:6px;font:12px ui-monospace,monospace}
#panel pre{white-space:pre-wrap;font-size:12px;margin:6px 0}
.modal{position:fixed;inset:0;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;padding:16px;z-index:10}
.modal[hidden]{display:none}
.box{background:var(--panel);border:1px solid var(--gold);border-radius:12px;max-width:560px;width:100%;max-height:85vh;overflow:auto;padding:18px}
.dlg-dock{position:fixed;left:0;right:0;bottom:120px;display:flex;justify-content:center;padding:0 8px;z-index:10;pointer-events:none}
.dlg-dock[hidden]{display:none}
.npc-dlg{pointer-events:auto;position:relative;box-sizing:border-box;width:min(100%,var(--w,461px));min-height:var(--h,169px);max-height:70vh;display:flex;flex-direction:column;background:rgba(8,14,12,.35);color:#82caa0;font-size:14px;line-height:1.55;border:16px solid transparent;border-image:url(assets/ui/dlg-say.png) 16 fill/16px stretch;margin:0;padding:0 4px}
.npc-dlg[data-frame=big]{border-image-source:url(assets/ui/dlg-big.png)}.npc-dlg[data-frame=mid]{border-image-source:url(assets/ui/dlg-mid.png)}
.npc-dlg>*{margin:0 6px}
#dlg-npc{color:#ffe6a0;font-weight:700;margin-bottom:4px;text-shadow:0 1px 0 #000}
#dlg-page{position:absolute;top:2px;right:10px;font-size:11px;color:#9bb}
#dlg-msg{white-space:pre-wrap;overflow-y:auto;flex:1 1 auto;min-height:2.4em;text-shadow:0 1px 0 #000a;margin-bottom:8px}
#dlg-opts{display:flex;flex-direction:column;gap:1px;overflow-y:auto;max-height:36vh;margin-bottom:6px}
#dlg-opts button{text-align:left;background:transparent;border:0;border-radius:3px;color:#fffcb2;padding:2px 6px;font:inherit;cursor:pointer;text-shadow:0 1px 0 #000}
#dlg-opts button b{color:#cdb;font-weight:400}
#dlg-opts button.sel,#dlg-opts button:hover{background:rgba(140,121,99,.55);color:#fffd7a}
.npc-dlg[data-kind=talk] #dlg-opts{align-items:flex-end}
@media (max-width:700px){.dlg-dock{bottom:8px}.npc-dlg{max-height:62vh;font-size:15px}#dlg-opts button{padding:7px 8px}}
#prompt .row{display:flex;gap:8px;margin-top:10px}#prompt-input{width:100%;margin-top:8px}
#toast{position:fixed;top:64px;left:50%;transform:translateX(-50%);background:var(--panel);border:1px solid var(--gold);color:var(--gold);padding:6px 14px;border-radius:20px;opacity:0;transition:opacity .25s;pointer-events:none;z-index:20}
#toast.on{opacity:1}
.c-red{color:#e0604c}.c-green{color:#6fc06f}.c-yellow,.c-gold{color:#e6b84a}.c-blue{color:#6aa5e0}.c-pink{color:#e08ab4}.c-orange{color:#e8913a}.c-white{color:inherit}.c-cyan{color:#5ec5c5}.c-purple{color:#a58ae0}
[hidden]{display:none!important}

.ico{display:inline-block;width:40px;height:40px;object-fit:contain;background:var(--bg);border:1px solid var(--line);border-radius:6px;vertical-align:middle}
.box.wide{max-width:640px}.shop-head{display:flex;gap:16px;align-items:center;margin-bottom:10px}.shop-head b:first-child{flex:1;color:var(--gold)}
#shop-list .row{display:grid;grid-template-columns:48px 1fr auto auto;gap:10px;align-items:center;padding:4px 0;border-bottom:1px solid var(--line)}
#shop-list .pr{color:var(--gold);font-variant-numeric:tabular-nums}
#npc-card{display:inline-flex;gap:8px;align-items:center}#npc-card small{color:var(--dim)}
#panel td{vertical-align:middle}

#stage{position:relative;min-height:340px;overflow:hidden;background:#24301f}
#stage .gl,#stage .labels{position:absolute;inset:0;width:100%;height:100%;display:block}
#stage .labels{pointer-events:none}
#char-select{max-width:150px}

/* minimap + hotbar overlays on the stage */
#minimap{position:absolute;top:8px;right:8px;z-index:3;background:rgba(10,8,6,.78);border:1px solid var(--gold);border-radius:8px;padding:4px;box-shadow:0 2px 10px rgba(0,0,0,.5)}
#minimap canvas{display:block;border-radius:4px;cursor:crosshair}
#minimap .mm-bar{display:flex;justify-content:space-between;align-items:center;color:#e8dcc4;font-size:11px;padding:0 2px 3px}
#minimap button{background:transparent;border:0;color:#e8dcc4;padding:0 4px;cursor:pointer;font-size:13px}
#minimap .cam-zoom{display:flex;align-items:center;gap:3px;margin-top:3px}.cam-zoom input{width:100px;min-width:0;accent-color:var(--gold)}.cam-zoom button{width:24px;height:24px;border:1px solid #6b5734!important;border-radius:5px;font-size:18px!important;line-height:18px}.cam-zoom output{width:34px;text-align:right;color:#e8dcc4;font-size:9px}
#hotbar{position:absolute;right:10px;bottom:10px;display:flex;flex-direction:column;gap:3px;z-index:3;background:rgba(10,8,6,.7);padding:4px;border-radius:8px;border:1px solid var(--line)}
#hotbar .hrow{display:flex;gap:3px;align-items:center}#hotbar .hrow u{width:30px;text-decoration:none;font-size:10px;color:var(--gold);text-align:center;cursor:help}
#hotbar .slot{width:38px;height:38px;border:1px solid #5a4a30;border-radius:6px;background:#1b1610;position:relative;cursor:pointer;display:flex;align-items:center;justify-content:center;color:#e8dcc4;font-size:10px;text-align:center;overflow:hidden}
#hotbar .slot img{width:36px;height:36px;object-fit:contain}#hotbar .slot b{position:absolute;left:2px;top:0;font-size:10px;color:var(--gold)}
#hotbar .slot.cd{filter:brightness(.5)}
/* floating window */
.box.win{max-width:760px;width:100%;height:min(80vh,640px);display:flex;flex-direction:column;padding:0}
.win-head{display:flex;justify-content:space-between;align-items:center;padding:10px 14px;border-bottom:1px solid var(--line);color:var(--gold)}
#win-body{flex:1;overflow:auto;padding:12px}
.tabs{display:flex;gap:4px;flex-wrap:wrap;margin-bottom:8px}.tabs button.on{border-color:var(--gold);color:var(--gold)}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(64px,1fr));gap:6px}
.cell{border:1px solid var(--line);border-radius:6px;padding:4px;text-align:center;cursor:pointer;background:var(--panel2);font-size:11px;line-height:1.2;min-height:70px}
.cell:hover,.cell.sel{border-color:var(--gold)}.cell img,.cell .ph{width:36px;height:36px;object-fit:contain;display:block;margin:0 auto 3px}.cell .ph{background:var(--bg);border-radius:4px}
.cell .lv{color:var(--gold)}.cell.off{opacity:.55}
.detail{border:1px solid var(--line);border-radius:8px;padding:10px;margin-top:10px;min-height:90px;background:var(--panel2)}
.detail h4{margin:0 0 4px;color:var(--gold)}.detail .row{display:flex;gap:8px;margin-top:8px;flex-wrap:wrap}
.form{display:grid;grid-template-columns:110px 1fr auto;gap:8px;align-items:center;margin-bottom:8px}.form input,.form select{width:100%}
.list .it{display:grid;grid-template-columns:44px 1fr auto auto;gap:8px;align-items:center;padding:3px 0;border-bottom:1px solid var(--line)}
.list .it small{color:var(--dim)}
#sk-grid{max-height:300px;overflow:auto;padding:2px}
.detail{position:sticky;bottom:0}

#actions{position:absolute;left:10px;bottom:62px;z-index:3;display:flex;gap:4px;background:rgba(10,8,6,.7);padding:4px;border-radius:8px;border:1px solid var(--line)}
#actions button{background:#1b1610;border:1px solid #5a4a30;border-radius:6px;color:#e8dcc4;font-size:12px;padding:6px 8px;cursor:pointer}
#actions button.on{border-color:var(--gold);color:var(--gold)}

#vitals,#targetf{position:absolute;left:10px;z-index:3;width:210px;background:rgba(10,8,6,.72);border:1px solid var(--line);border-radius:8px;padding:5px 8px;color:#e8dcc4;font-size:12px}
#vitals{top:8px}#targetf{top:104px;border-color:#7a3a30}
#vitals .who,#targetf .who{font-weight:600;margin-bottom:3px}#vitals small,#targetf small{color:#b9a87c;font-weight:400}
.bar{position:relative;height:13px;background:#2a2118;border-radius:3px;margin-top:3px;overflow:hidden}.bar i{position:absolute;left:0;top:0;bottom:0;transition:width .15s}
.bar span{position:absolute;inset:0;text-align:center;font-size:10px;line-height:13px;color:#fff;text-shadow:0 0 2px #000}
.bar.hp i{background:#c0392b}.bar.mp i{background:#2f6fbf}.bar.xp{height:7px}.bar.xp i{background:#d4a73a}.bar.xp span{display:none}
#deadmsg{position:absolute;left:50%;top:38%;transform:translate(-50%,-50%);z-index:4;background:rgba(40,0,0,.75);color:#ffb0a0;border:1px solid #a33;padding:14px 22px;border-radius:10px;font-size:18px;pointer-events:none}

/* ---- game-style windows (character / bag) ---- */
.box.win.jx{background:linear-gradient(180deg,#14504d,#0c3433);border:2px solid #b89a52;color:#f3e7c4;box-shadow:0 8px 30px rgba(0,0,0,.6);border-radius:10px}
.box.win.jx .win-head{background:linear-gradient(90deg,#0f6a66,#14504d);border-bottom:2px solid #b89a52;color:#fff;font-size:18px}
.box.win.jx #win-body{background:transparent;padding:10px}
.box.win.jx-char{max-width:760px;height:auto;min-height:540px}.box.win.jx-bag{max-width:720px;height:auto}
.jx-slot{position:relative;width:60px;height:60px;border:2px solid #7a6a3c;background:#0d3a2e;border-radius:4px;display:flex;align-items:center;justify-content:center;flex:none}
.jx-slot.full{border-color:#c9ad66;cursor:pointer;background:#0f4a3a}.jx-slot.dim{background:#1a2a26;border-color:#3a4a40}.jx-slot.mini{width:40px;height:40px;background:#1a2a26;border-color:#3a4a40}
.jx-slot .ico{width:100%;height:100%;border:0;background:none;border-radius:0;object-fit:contain}
.jx-slot .enh{position:absolute;right:1px;top:-1px;color:#ffd23a;font-style:normal;font-weight:700;font-size:13px;text-shadow:0 0 3px #000,0 0 3px #000}
.jx-slot .cnt{position:absolute;right:3px;bottom:0;color:#fff;font-style:normal;font-weight:700;font-size:13px;text-shadow:0 0 3px #000,0 0 3px #000}
.jx-slot em{position:absolute;left:2px;bottom:0;font-style:normal;font-size:10px;color:#b9c9b0;text-shadow:0 0 3px #000}.jx-slot.full em{display:none}
.jx-slot[data-sel="1"]{outline:2px solid #ffd23a}
#eq-root{display:flex;gap:10px}.jx-side{display:flex;flex-direction:column;gap:10px;width:150px;flex:none}
.jx-tab{background:linear-gradient(180deg,#e9d49a,#b89a52);color:#2b2008;border:2px solid #7a6a3c;border-radius:6px;font-size:17px;padding:8px}.jx-tab:not(.on){background:#0f4a47;color:#f3e7c4}
.jx-detail{margin-top:auto;background:transparent;border:0;color:#f3e7c4;font-size:18px;text-align:left;cursor:pointer}
.jx-main{flex:1;background:#e7d7ad url() center;border:2px solid #7a6a3c;border-radius:6px;padding:10px;color:#2b2008}
.jx-stage{display:flex;justify-content:space-between;gap:8px}.jx-col{display:flex;flex-direction:column;gap:8px}.jx-pair{display:flex;align-items:center;gap:6px}
.jx-mid{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:180px}.jx-mid img{max-width:100%;max-height:330px;image-rendering:auto;border-radius:6px}.jx-name{margin-top:4px;font-weight:700}
.jx-foot{display:flex;gap:18px;margin-top:8px;font-size:15px}.jx-lines{margin-top:6px;font-size:14px;line-height:1.5}
.jx-bagtop{display:flex;gap:8px;align-items:flex-start}.jx-grid{display:grid;grid-template-columns:repeat(5,60px);gap:4px;background:#0a2a26;padding:4px;border:2px solid #7a6a3c;border-radius:4px}
.jx-bagtabs{display:flex;flex-direction:column;gap:4px}.jx-bagtabs button{width:44px;height:90px;background:#1b5e5a;border:2px solid #7a6a3c;color:#f3e7c4;border-radius:4px;font-size:20px;cursor:pointer}.jx-bagtabs button.on{background:#b89a52;color:#2b2008}.jx-bagtabs span{display:block;font-size:18px}
.jx-menu{display:flex;flex-direction:column;gap:6px;flex:1}.jx-menu button{height:56px;background:linear-gradient(180deg,#14605a,#0f4a47);border:2px solid #7a6a3c;color:#f3e7c4;font-size:16px;border-radius:4px;cursor:pointer}.jx-menu button:disabled{opacity:.5}
.jx-money{display:flex;gap:10px;margin:8px 0}.jx-money>div{flex:1;background:#6b6b66;padding:6px 10px;border-radius:3px;color:#fff;font-size:15px}
.jx-info{background:#d9cba4;color:#2b2008;border-radius:4px;padding:8px 10px;display:flex;justify-content:space-between;align-items:center;min-height:62px}
.jx-btns button{background:#e9d49a;border:2px solid #7a6a3c;color:#2b2008;font-size:15px;padding:6px 14px;border-radius:5px;margin-left:6px;cursor:pointer}.jx-btns button:disabled{opacity:.5}
/* floating windows */
.fwin{position:fixed;z-index:8;top:84px;border-radius:10px;background:linear-gradient(180deg,#14504d,#0c3433);border:2px solid #b89a52;color:#f3e7c4;box-shadow:0 8px 30px rgba(0,0,0,.6);max-height:calc(100vh - 100px);overflow:auto}
#fchar{left:20px;width:min(640px,calc(100vw - 40px))}#fbag{right:20px;width:min(600px,calc(100vw - 40px))}
.fwin .win-head{cursor:move;background:linear-gradient(90deg,#0f6a66,#14504d);border-bottom:2px solid #b89a52;color:#fff;font-size:18px;padding:8px 12px;display:flex;justify-content:space-between;align-items:center}
.fwin .win-head button{background:#e7d7ad;border:1px solid #7a6a3c;color:#2b2008;border-radius:4px;cursor:pointer}.fwin .fbody{padding:10px}
.jx-arrow{width:12px;color:#c9ad66;text-align:center}.jx-mid img{background:radial-gradient(ellipse at 50% 85%,rgba(120,100,60,.25),transparent 60%);border-radius:0}
@media (max-width:1100px){#fbag{top:auto;bottom:10px}}
.wm-grid{grid-template-columns:repeat(auto-fill,minmax(110px,1fr))}.wm-grid .cell{min-height:96px}.wm-grid .cell img{width:100%;height:56px;object-fit:cover;border-radius:4px;margin:0 0 3px}
#minimap .mm-bar button#mm-world{font-size:11px;border:1px solid var(--gold);border-radius:4px;margin-right:4px;padding:0 6px}
#itemtip{position:fixed;z-index:20;min-width:210px;max-width:290px;background:rgba(10,24,22,.97);border:2px solid #b89a52;border-radius:8px;padding:8px 10px;color:#f3e7c4;font-size:13px;box-shadow:0 6px 24px rgba(0,0,0,.6);pointer-events:none}
#itemtip .th{font-size:15px;margin-bottom:4px;border-bottom:1px solid #4b5a4a;padding-bottom:3px}#itemtip .gold,#itemtip .tr.gold{color:#ffd23a}#itemtip .tr{display:flex;justify-content:space-between;gap:12px;padding:1px 0}#itemtip .tr.bad{color:#ff7a66}#itemtip .tr.dim,#itemtip .hint{color:#9fb0a0}
#itemtip .set{margin-top:6px;padding-top:4px;border-top:1px dotted #4b5a4a}#itemtip .set div{color:#7d8a7e}#itemtip .set div.on{color:#7dff7d}#itemtip .desc{margin:5px 0;color:#d6e6c8;white-space:pre-wrap}#itemtip .hint{margin-top:6px;font-size:11px;border-top:1px dotted #4b5a4a;padding-top:3px}
.box.win.wm{max-width:1100px;width:96vw;height:min(88vh,720px)}#wm-root{display:flex;gap:10px;height:100%}#wm-cv{flex:1;min-width:0;height:100%;border:2px solid #7a6a3c;border-radius:6px;cursor:grab}
#wm-side{width:230px;flex:none;overflow:auto;background:var(--panel2);border:1px solid var(--line);border-radius:6px;padding:8px;font-size:13px}#wm-side img{width:100%;border-radius:4px;background:#000}#wm-side h4{margin:6px 0 2px;color:var(--gold)}#wm-side .dim{color:var(--dim)}#wm-side select{width:100%;margin:4px 0 8px}#wm-side button{width:100%}
.wm-nb{margin:6px 0}.wm-nb a{color:var(--blue);cursor:pointer;text-decoration:underline}
#fdetail{position:fixed;z-index:9;width:330px;background:#0a0a0a;border:2px solid #b89a52;border-radius:8px;padding:10px 14px;color:#fff;font-size:16px;line-height:1.38;overflow:auto;box-shadow:0 8px 30px rgba(0,0,0,.6)}
#fdetail .dr{display:flex;justify-content:space-between;gap:10px}#fdetail .dr.hp{color:#ff5a4a}#fdetail .dr.mp{color:#5aa0ff}#fdetail .dr.sp{color:#5ad25a}#fdetail .dr.at b{color:#ffd23a}#fdetail .gap{height:14px}#fdetail .pt{margin-top:10px;padding-top:8px;border-top:1px solid #333}
#fdetail button{background:#e9d49a;border:1px solid #7a6a3c;color:#2b2008;border-radius:4px;cursor:pointer;padding:0 8px;font-weight:700}
#wm-main{flex:1;min-width:0;height:100%;position:relative;display:flex}#wm-main #wm-cv{flex:1;touch-action:none;-webkit-user-select:none;user-select:none}
#wm-search{position:absolute;left:10px;top:10px;z-index:2;width:240px}#wm-search input{width:100%;padding:6px 10px;border-radius:6px;border:1px solid #7a6a3c;background:rgba(251,246,234,.95);color:#2b2008}
#wm-res{background:rgba(251,246,234,.97);border:1px solid #7a6a3c;border-radius:6px;margin-top:2px;max-height:260px;overflow:auto}#wm-res:empty{display:none}#wm-res a,#wm-res i{display:block;padding:4px 10px;cursor:pointer;color:#2b2008;font-size:13px}#wm-res a:hover{background:#e9d49a}
#wm-tools{position:absolute;right:10px;top:10px;z-index:3;display:flex;gap:4px;padding:3px;background:rgba(20,17,14,.78);border:1px solid #7a6a3c;border-radius:8px}#wm-tools button{width:36px;height:36px;padding:0;font-size:21px;font-weight:700;background:#ead9a8;color:#2b2008;border-color:#806a38}#wm-gesture{position:absolute;left:50%;bottom:8px;z-index:2;transform:translateX(-50%);padding:3px 9px;border-radius:12px;background:rgba(20,17,14,.7);color:#f3e7c4;font-size:10px;white-space:nowrap;pointer-events:none}

/* ---- full-bleed view: toolbars float over the stage ---- */
header{padding:4px 12px;gap:10px}.brand{font-size:15px}#hud{gap:10px;font-size:12px}
main{display:block;position:relative;padding:0;overflow:hidden}
#world{position:absolute;inset:0;border:0;border-radius:0;background:transparent}
.split{display:block;position:absolute;inset:0}#stage{position:absolute;inset:0;min-height:0}#map{position:absolute;inset:0;min-height:0}
#dock{position:absolute;top:8px;left:250px;right:240px;z-index:6;display:flex;gap:8px;align-items:center;flex-wrap:wrap;padding:5px 8px;border:1px solid rgba(184,154,82,.7);border-radius:10px;background:rgba(10,8,6,.62);backdrop-filter:blur(3px);width:max-content;max-width:calc(100% - 500px);color:#e8dcc4;font-size:12px}
#dock select,#dock input{background:rgba(20,17,14,.85);color:#e8dcc4;border:1px solid #5a4a30;border-radius:6px;padding:3px 6px;font-size:12px}#dock .mapsel select{max-width:210px}#dock #char-select{max-width:130px}
#dock #map-info{margin-left:0;color:#b9ad92}#dock #npc-card{color:#e8dcc4}
.npcsearch{position:relative;display:flex;gap:4px}.npcsearch input{width:140px}.npcsearch button{background:rgba(20,17,14,.85);color:#e8dcc4;border:1px solid #5a4a30;border-radius:6px;cursor:pointer;padding:0 8px}
#npc-list{display:none;position:absolute;top:30px;left:0;width:300px;max-height:min(60vh,520px);background:rgba(10,8,6,.94);border:1px solid #b89a52;border-radius:8px;z-index:8;color:#e8dcc4}
.npcsearch:focus-within #npc-list,.npcsearch.open #npc-list{display:block}#npc-list li:hover{background:rgba(184,154,82,.25)}
#side{position:absolute;left:10px;bottom:104px;width:min(460px,46vw);height:232px;z-index:5;background:rgba(10,8,6,.55);border:1px solid rgba(90,74,48,.8);border-radius:8px;color:#e8dcc4;overflow:hidden;display:flex;flex-direction:column}
#side #chat{min-height:0;font-size:12px;padding:6px 8px 6px 34px;color:#f0e6cf}#side #chat .k-sys,#side #chat div{color:#f0e6cf}#side #chat .k-tip{color:#ffd23a}#side #chat .k-world,#side #chat .k-news,#side #chat .k-err{color:#ff8a78}#side #chat .k-npc{color:#8be08b}#side #chat .k-map,#side #chat .k-mission,#side #chat .k-team{color:#8ab8f0}#chat-toggle{position:absolute;left:4px;top:4px;z-index:2;background:transparent;border:0;cursor:pointer;font-size:16px}
body.chat-min #side{height:30px}body.chat-min #side #chat{display:none}
#panel:not([hidden]){position:fixed;right:12px;top:56px;width:min(420px,92vw);max-height:70vh;overflow:auto;z-index:9;background:var(--panel);border:1px solid var(--gold);border-radius:10px;padding:10px;box-shadow:0 8px 30px rgba(0,0,0,.6)}
@media (max-width:900px){#dock{left:8px;right:8px;max-width:calc(100% - 16px);top:96px}}

kbd{font:600 10px/1 system-ui;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.35);border-radius:3px;padding:1px 4px;margin-left:3px;color:#ffd23a}
#actions kbd,.act kbd{color:#ffd23a}
#chat-in{display:flex;gap:4px;padding:4px 6px;border-top:1px solid rgba(184,154,82,.5);background:rgba(10,8,6,.5)}#chat-in select,#chat-in input{background:rgba(20,17,14,.9);color:#f0e6cf;border:1px solid #5a4a30;border-radius:5px;font-size:12px;padding:2px 6px}#chat-in input{flex:1;min-width:0}
.k-near{color:#ffe9a0}.k-world{color:#ff9a8a}body.chat-min #chat-in{display:none}body.chat-min #side{height:30px}
#expbar{position:absolute;left:0;right:0;bottom:0;height:14px;z-index:4;background:rgba(10,8,6,.75);border-top:1px solid rgba(184,154,82,.6)}#expbar i{position:absolute;left:0;top:0;bottom:0;background:linear-gradient(90deg,#8a6a1c,#e8b83a);transition:width .4s}#expbar span{position:absolute;inset:0;text-align:center;font-size:10px;line-height:14px;color:#fff;text-shadow:0 0 3px #000,0 0 3px #000}
#hotbar{bottom:20px}#side{bottom:112px}.act,#actions{bottom:20px}
#itemtip .opt{color:#7dd6ff;padding:1px 0}
#hotbar .slot .cdov{position:absolute;inset:0;background:rgba(0,0,0,.62);color:#fff;font:700 13px/38px system-ui;text-align:center;text-shadow:0 0 3px #000}
.skrel{margin-top:6px;padding:6px 8px;border:1px dashed var(--line);border-radius:6px;font-size:12px;line-height:1.6}
/* NPC card on the dark toolbar: readable buttons */
#dock #npc-card b{color:#fff}#dock #npc-card small{color:#c9bd9f}
#dock #npc-card button{background:#d9a441;color:#1a1208;border:1px solid #f3d27a;border-radius:6px;padding:3px 12px;font-weight:700;cursor:pointer}
#dock #npc-card button[data-act="kill"]{background:#c0392b;color:#fff;border-color:#ff8a78}
#dock #npc-card button:hover{filter:brightness(1.12)}
#vitals{width:260px}.vtrow{display:flex;gap:8px;align-items:center}.vtmain{flex:1;min-width:0}
#avatar{position:relative;width:54px;height:54px;flex:none;border-radius:50%;border:3px solid var(--c,#b89a52);background:radial-gradient(circle at 50% 30%,#3a4a40,#14201c);overflow:hidden;cursor:pointer;box-shadow:0 0 8px rgba(0,0,0,.6)}
#avatar img{position:absolute;left:50%;top:0;width:150%;height:auto;left:-25%;top:0;transform:none}#avatar b{position:absolute;right:2px;bottom:0;font-size:11px;background:var(--c,#b89a52);color:#111;border-radius:3px;padding:0 3px;line-height:14px}
#avatar:hover{filter:brightness(1.2)}
.hint-nc{color:#d9a441;font-size:13px;margin:6px 0 12px;text-align:center;max-width:520px}
.brand .info{font-style:normal;color:var(--dim);cursor:help;font-size:14px}
#footnote{position:fixed;left:10px;bottom:352px;z-index:6;font-size:13px;font-weight:600;line-height:1.35;color:#fff3c4;background:rgba(10,8,6,.72);border:1px solid rgba(255,210,58,.7);border-radius:8px;padding:4px 10px;box-shadow:0 0 10px rgba(255,210,58,.25);text-shadow:0 0 3px #000;pointer-events:none;max-width:460px}
body.chat-min #footnote{bottom:154px}
.na-btn{width:100%;margin-bottom:8px;background:linear-gradient(180deg,#e9d49a,#c9a64e);color:#2b2008;font-weight:700;border:1px solid #7a6a3c}
#na-mini{display:block;width:100%;margin-top:4px;background:linear-gradient(180deg,#e9d49a,#c9a64e)!important;color:#2b2008!important;font-weight:700;border:1px solid #7a6a3c!important;border-radius:6px;padding:4px 8px!important;font-size:12px!important;cursor:pointer}
#buffbar{position:absolute;left:0;top:calc(100% + 6px);z-index:3;display:flex;gap:4px;flex-wrap:wrap;width:max-content;max-width:min(300px,calc(100vw - 12px));pointer-events:auto}
#buffbar .bf{position:relative;width:34px;height:34px;border:1px solid #b89a52;border-radius:6px;background:rgba(10,8,6,.75);display:flex;align-items:center;justify-content:center;color:#e8dcc4;font-size:11px;overflow:hidden}
#buffbar .bf img{width:30px;height:30px;object-fit:contain}#buffbar .bf i{position:absolute;right:1px;bottom:0;font-style:normal;font-size:10px;font-weight:700;color:#fff;text-shadow:0 0 3px #000,0 0 3px #000}
.bar.gas i{background:linear-gradient(90deg,#6a3ad8,#c28bff)}
#hotbar .slot .md{position:absolute;right:1px;top:0;font-style:normal;font-size:9px;line-height:1;text-shadow:0 0 2px #000}
#selskill{position:absolute;right:400px;bottom:20px;z-index:3;background:rgba(10,8,6,.78);border:1px solid #6b5734;border-radius:8px;padding:3px;color:#f3e7c4;text-align:center;font-size:10px;display:flex;gap:3px}
#selskill .mouse-skill{width:76px;min-height:76px;border:2px solid #ffd23a;border-radius:6px;padding:3px;display:flex;flex-direction:column;align-items:center;gap:2px;cursor:pointer}#selskill .mouse-skill.right{border-color:#56b8ff}#selskill img{width:40px;height:40px;object-fit:contain}#selskill small{line-height:1.15;color:#e8dcc4}#selskill b{color:#ffd23a;font-size:10px}#selskill .right b{color:#56b8ff}#selskill .ph{display:block;width:40px;height:40px;line-height:40px;border:1px dashed #7a6a3c;border-radius:6px;color:#9a8d75}
#hotbar .slot.picked-left{outline:2px solid #ffd23a;box-shadow:0 0 8px #ffd23a}#hotbar .slot.picked-right{box-shadow:inset 0 0 0 2px #56b8ff,0 0 8px #56b8ff}#hotbar .slot.picked-left.picked-right{outline:2px solid #ffd23a;box-shadow:inset 0 0 0 2px #56b8ff,0 0 8px #ffd23a}
.grid .cell{position:relative}.grid .cell .mbind{position:absolute;top:2px;width:15px;height:15px;border-radius:50%;font:700 9px/15px system-ui;color:#111;text-align:center}.grid .cell .mbind.left{left:2px;background:#ffd23a}.grid .cell .mbind.right{right:2px;background:#56b8ff}
.sk-pick-note{margin:-2px 0 7px;padding:6px 8px;border:1px solid #7a642f;border-radius:5px;background:#2a2112;color:#f0d98a;font-size:12px}
#gasbar{position:absolute;right:400px;bottom:104px;z-index:3;width:92px;background:rgba(10,8,6,.78);border:1px solid #9a6ad8;border-radius:8px;padding:3px 5px;color:#e8dcc4;font-size:10px;text-align:center}
#gasbar .cells{display:flex;flex-wrap:wrap;gap:2px;justify-content:center;margin:2px 0}#gasbar i{width:7px;height:9px;border-radius:2px;background:#2a2238;border:1px solid #5a4a78}#gasbar i.on{background:linear-gradient(180deg,#d8b8ff,#8a4ad8);box-shadow:0 0 4px #b98cff}#gasbar b{color:#d8b8ff}

/* ---- phones / small landscape screens ---- */
#hb-toggle,#nav-toggle,#dock-toggle,#bag-fab,#gm-fab{display:none}
@media (max-height:560px){
  header{padding:2px 8px;gap:6px;min-height:0}.brand{font-size:12px}.brand span{display:none}#hud{font-size:11px;gap:6px}
  header nav{display:none;position:fixed;top:30px;right:6px;z-index:30;flex-direction:column;background:var(--panel);border:1px solid var(--gold);border-radius:8px;padding:6px;max-height:calc(100vh - 40px);overflow:auto}
  body.nav-open header nav{display:flex}
  #nav-toggle{display:block;position:fixed;top:2px;right:6px;z-index:31;padding:2px 10px;font-size:16px;background:var(--panel2);border:1px solid var(--gold);border-radius:6px;color:var(--text)}
  #vitals{width:190px;padding:3px 5px;top:4px}#vitals .who{font-size:11px;margin-bottom:1px}#avatar{width:38px;height:38px}#vitals .bar{height:11px}#vitals .bar span{font-size:9px;line-height:11px}
  #targetf{top:70px;width:170px}
  #dock{top:4px;left:205px;right:auto;max-width:calc(100% - 330px);padding:2px 5px;gap:4px;font-size:11px}#dock select,#dock input{padding:1px 4px;font-size:11px}.npcsearch input{width:90px}#dock #map-info{display:none}#dock .mapsel select{max-width:120px}#dock #char-select{max-width:90px}
  #vitals>#buffbar{left:0;top:calc(100% + 4px);max-width:min(300px,calc(100vw - 8px))}#buffbar .bf{width:26px;height:26px}#buffbar .bf img{width:22px;height:22px}
  #minimap{top:4px;right:46px;padding:2px}#minimap canvas{width:120px!important;height:96px!important}#minimap .mm-bar{font-size:9px}#na-mini{font-size:10px!important;padding:2px 4px!important}
  #side{left:4px;bottom:34px;width:min(300px,38vw);height:78px}#side #chat{font-size:10px;padding:3px 4px 3px 22px}#chat-toggle{font-size:12px}#chat-in{padding:1px 3px}#chat-in select,#chat-in input{font-size:10px;padding:0 3px}#footnote{display:none}
  #actions{left:4px;bottom:4px;padding:2px;gap:2px}#actions button{padding:3px 5px;font-size:10px}#actions kbd{display:none}
  #hotbar{display:flex;right:4px;bottom:14px}body.hb-open #hotbar{display:flex}#hotbar .slot{width:30px;height:30px}#hotbar .slot img{width:26px;height:26px}#hotbar .hrow u{width:16px;font-size:8px}#hotbar .slot b{font-size:8px}
  #hb-toggle{display:none}
  #selskill{display:none}#gasbar{right:8px;bottom:158px;width:70px}
  #expbar{height:10px}#expbar span{font-size:8px;line-height:10px}
  #stage #joy{display:block;left:14px;bottom:116px;width:92px;height:92px}
  #res-toggle{right:8px;top:112px}
  .fwin{top:34px;max-height:calc(100vh - 44px)}#fchar{left:4px;width:min(520px,62vw)}#fbag{right:4px;width:min(420px,56vw)}.jx-slot{width:44px;height:44px}.jx-grid{grid-template-columns:repeat(5,44px)}.jx-mid{min-width:120px}.jx-mid img{max-height:220px}
  .box.win{height:calc(100vh - 20px)!important;max-width:96vw}.modal{padding:6px}#itemtip{font-size:11px}
}

/* Installed landscape PWA: occupy the complete viewport and never let the app
   gesture turn into page scrolling/rubber-banding. Inventory clicks and double
   clicks still bubble normally because this is CSS gesture control only. */
@media (max-height:560px) and (pointer:coarse){
  html,body{position:fixed;inset:0;width:100%;height:100%;height:100dvh;overflow:hidden;overscroll-behavior:none;touch-action:none;-webkit-text-size-adjust:100%}
  #app{position:fixed;inset:0;width:100%;height:100%;height:100dvh;overflow:hidden;padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
  main,#world,.split,#stage{overflow:hidden;overscroll-behavior:none}
  #stage,.gl,.labels{touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
  input,textarea,select,.jx-slot,[data-un],[data-fz]{touch-action:manipulation}
  header{padding-left:calc(8px + env(safe-area-inset-left));padding-right:calc(8px + env(safe-area-inset-right))}
  #stage #joy{left:calc(env(safe-area-inset-left) + 30px)}
}
html.touch-ui body,html.touch-ui #app{-webkit-touch-callout:none}html.touch-ui :not(input):not(textarea){-webkit-user-select:none;user-select:none}
html.touch-ui input,html.touch-ui textarea{-webkit-user-select:text;user-select:text}

#questtrack{position:absolute;left:12px;top:150px;z-index:3;width:190px;background:rgba(10,8,6,.78);border:1px solid #7a6a3c;border-radius:8px;padding:5px 8px;color:#f3e7c4;font-size:11px;cursor:pointer;display:flex;flex-direction:column;gap:2px}
#questtrack b{color:#ffd23a}#questtrack small{color:#e8dcc4}#questtrack i{color:#7ee08a;font-style:normal}#questtrack.ok{border-color:#7ee08a;box-shadow:0 0 8px #7ee08a88}
#res-toggle{position:absolute;right:12px;top:250px;z-index:12;width:38px;height:38px;font-size:20px;border-radius:50%}#res-panel{position:absolute;right:58px;top:80px;bottom:58px;z-index:20;width:min(410px,70vw);padding:9px;background:rgba(18,14,10,.97);border:1px solid #806a3a;border-radius:8px;box-shadow:0 8px 30px #000;overflow:hidden}.res-head{display:flex;justify-content:space-between;align-items:center;color:#f0c96a;margin-bottom:6px}#res-panel>[data-search]{box-sizing:border-box;width:100%;margin-bottom:4px}.res-note{font-size:11px;color:#b9aa8d;margin-bottom:6px}.res-grid{height:calc(100% - 120px);overflow:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(98px,1fr));gap:5px;align-content:start}.res-item{height:98px;padding:3px;overflow:hidden}.res-item>span{display:block;position:relative;width:90px;height:68px;overflow:hidden;margin:auto;background:#090806}.res-item img{position:absolute;max-width:none}.res-item small{display:block;overflow:hidden;text-overflow:ellipsis}.res-item.pick{outline:2px solid #ffd23a}.res-foot{display:flex;gap:5px;align-items:center;justify-content:space-between;font-size:10px;padding-top:5px}.res-row{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #4d4028;padding:5px}.res-row small{color:#a99b82}.gl.res-drop{outline:3px solid #ffd23a;outline-offset:-4px}@media(max-width:650px){#res-panel{right:5px;top:70px;width:calc(100% - 28px)}#res-toggle{right:6px;top:250px}}
#skills-fab{position:absolute;right:58px;top:250px;z-index:12;width:42px;height:42px;border-radius:50%;padding:0;font-size:22px;color:#fff4cf;background:radial-gradient(circle at 35% 25%,#b8893d,#51300f 72%);border:2px solid #e4bd69;box-shadow:0 3px 12px #000,0 0 9px rgba(228,189,105,.35);cursor:pointer}#skills-fab:hover{filter:brightness(1.18);transform:translateY(-1px)}
.quest-tabs{display:flex;gap:5px;margin:0 0 10px;border-bottom:1px solid #594621;padding-bottom:7px}.quest-tabs button{flex:1;padding:7px}.quest-tabs button.on{background:#c99b43;color:#201508;font-weight:700}.task-live{width:100%;border-collapse:collapse;font-size:12px}.task-live th,.task-live td{padding:6px 8px;border-bottom:1px solid #3a3226;text-align:left}.task-live th{color:#e8c76e}.task-empty{padding:28px;text-align:center;color:#9a8d75;border:1px dashed #54462d;border-radius:7px}
.qtab{width:100%;border-collapse:collapse;font-size:12px}.qtab td{padding:2px 5px;border-bottom:1px solid #3a3226}.qtab tr.now{background:#3a2f12}

/* ---- Lanh dia: construction / farming / economy ---- */
.box.win.land-win{width:min(980px,96vw);height:min(82vh,720px);max-width:none;padding:0;overflow:hidden;background:#17130e;border-color:#b78a36}.land-win .win-head{padding:12px 16px;background:linear-gradient(90deg,#37270f,#1d1710);border-bottom:1px solid #775a27}.land-win #win-body{height:calc(100% - 47px);overflow:auto}.land{min-height:100%;color:#eadfc7;background:radial-gradient(circle at 70% 0,#3b2b15 0,transparent 35%),#17130e}.land-hero{padding:18px 22px 12px;background:linear-gradient(115deg,rgba(91,62,21,.65),rgba(17,14,10,.3));border-bottom:1px solid #49391f}.land-hero>div:first-child{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap}.land-hero small{color:#e5b957;letter-spacing:1.5px;font-weight:800}.land-hero b{font:700 22px Georgia,serif;color:#fff0bd}.land-hero span{color:#b9aa8e;font-size:12px}.land-level{height:5px;margin-top:10px;background:#0c0a08;border-radius:5px;overflow:hidden}.land-level i{display:block;height:100%;background:linear-gradient(90deg,#9d6d1e,#f2c45e)}.land-res{display:grid;grid-template-columns:repeat(6,1fr);gap:1px;background:#44361f;border-bottom:1px solid #5a4828}.land-res span{padding:9px 10px;background:#211a11;text-align:center;font-size:15px}.land-res small{display:block;color:#91846d;font-size:9px;text-transform:uppercase;margin-top:2px}.land-res b{color:#fff1c8}.land-tabs{display:flex;gap:4px;padding:10px 18px 0;background:#17130e;position:sticky;top:0;z-index:2}.land-tabs button{flex:1;background:#211b13;color:#a99d88;border:1px solid #42351f;border-radius:6px 6px 0 0;padding:9px}.land-tabs button.on{background:#49371b;color:#ffd574;border-color:#a57a30;border-bottom-color:#49371b}.land-body{padding:16px 18px 28px}.land-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.land-card{min-height:112px;padding:14px;border:1px solid #4d3c22;border-radius:9px;background:linear-gradient(145deg,#292117,#1a1610)}.land-card.feature{border-color:#9b7130;background:linear-gradient(145deg,#493518,#20180d)}.land-card h3,.land-title{margin:0 0 8px;color:#f0c96a}.land-card p{margin:5px 0;color:#c7baa1;font-size:12px}.land-card small{display:block;color:#8f836d;margin-top:6px}.land button{border:1px solid #9b7532;background:linear-gradient(#dfb95f,#a97927);color:#211505;border-radius:5px;padding:6px 10px;font-weight:700;cursor:pointer}.land button:disabled{filter:grayscale(1);opacity:.38;cursor:not-allowed}.land-title{font-size:14px;margin-top:18px;border-bottom:1px solid #463820;padding-bottom:7px}.land-list{display:grid;gap:5px}.land-list article,.land-quests article{display:flex;align-items:center;gap:10px;padding:9px 12px;background:#211b13;border:1px solid #40341f;border-radius:7px}.land-list article>i,.land-quests article>i{font-style:normal;font-size:25px;width:36px;text-align:center}.land-list article>div,.land-quests article>div{flex:1}.land-list small,.land-quests small{display:block;color:#92866f}.land-list article>span{font-size:10px;color:#cca54f}.land-list article>span.live{color:#70d98c}.land-empty{padding:24px;text-align:center;color:#8e826d;border:1px dashed #483b26;border-radius:8px}.land-shop{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}.land-shop article{display:flex;align-items:center;gap:10px;padding:12px;background:#211b13;border:1px solid #4b3b21;border-radius:8px}.land-shop article>i{font-style:normal;font-size:31px}.land-shop article>div{flex:1;min-width:0}.land-shop p{margin:3px 0;color:#bbae96;font-size:12px}.land-shop small{color:#ddbb70}.land-banner{padding:10px 14px;margin-bottom:10px;background:#283019;border:1px solid #546331;border-radius:7px}.land-orders{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.land-orders article{display:flex;flex-direction:column;gap:7px;padding:13px;border:1px solid #504023;border-radius:8px;background:#211b13}.land-orders span{color:#b7aa91;font-size:12px}.land-orders strong{color:#f0c96a;font-size:12px}.land-quests{display:grid;gap:7px}.land-quests article.ready{border-color:#d3a33d;box-shadow:inset 3px 0 #d3a33d}.land-quests article.done{opacity:.62}.land-quests p{margin:3px 0;color:#bdaf96;font-size:12px}
@media(max-width:700px){.box.win.land-win{width:98vw;height:94vh}.land-res{grid-template-columns:repeat(3,1fr)}.land-grid,.land-shop,.land-orders{grid-template-columns:1fr}.land-tabs{overflow:auto;padding-left:8px;padding-right:8px}.land-tabs button{min-width:86px}.land-body{padding:10px}.land-hero{padding:12px}.land-hero b{font-size:18px}}
@media (pointer:coarse) and (max-width:900px),(pointer:coarse) and (max-height:560px){
  #win.world-map-open{z-index:1000;isolation:isolate}
  .box.win.wm{width:100vw;max-width:none;height:100dvh!important;max-height:none;border-radius:0}.box.win.wm .win-head{padding:6px 10px;min-height:42px}.box.win.wm #win-body{padding:0;min-height:0}
  #wm-root{gap:0;min-height:0}#wm-search{left:6px;top:6px;width:min(52%,260px)}#wm-search input{height:42px;padding:7px 10px}#wm-tools{right:6px;top:6px}#wm-tools button{width:42px;height:42px;font-size:24px}
  #wm-side{font-size:12px;padding:6px}#wm-side img{max-height:100px;object-fit:cover}#wm-side h4{margin:3px 0}#wm-side select,#wm-side button{min-height:40px;margin:3px 0}#wm-gesture{bottom:6px}
}
@media (pointer:coarse) and (max-width:600px) and (orientation:portrait){
  #wm-root{display:grid;grid-template-rows:minmax(0,1fr) auto}#wm-main{height:auto;min-height:0}#wm-side{width:100%;max-height:29dvh;border-radius:0;display:grid;grid-template-columns:88px 1fr;column-gap:8px;align-content:start}#wm-side img{grid-row:1/6;width:88px;height:72px}#wm-side h4,#wm-side .dim,#wm-side .wm-nb,#wm-side label,#wm-side select,#wm-side button{grid-column:2;margin-top:0}#wm-side .wm-nb{margin-bottom:3px;max-height:38px;overflow:auto}#wm-gesture{display:none}
}
@media (pointer:coarse) and (max-height:560px) and (orientation:landscape){
  #wm-root{flex-direction:row}#wm-main{height:100%}#wm-side{width:210px;max-height:none}#wm-side img{max-height:82px}#wm-gesture{display:none}
}
@media (max-height:560px){#skills-fab{right:52px;top:112px;width:38px;height:38px;font-size:19px}}
@media (max-width:760px) and (orientation:portrait){#skills-fab{right:52px;top:250px;width:40px;height:40px;font-size:20px}}
#audio-ctl{display:inline-flex;align-items:center;gap:3px;margin-right:6px}#audio-ctl button{padding:2px 6px}#audio-ctl input{width:58px}

/* ---- phones, portrait ---- */
@media (max-width:760px) and (orientation:portrait){
  html,body{height:100dvh;overscroll-behavior:none;-webkit-text-size-adjust:100%;touch-action:manipulation}
  #app{height:100dvh;padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
  .ld-card{padding:18px 14px 14px;border-width:14px}.ld-logo{font-size:27px}
  header{padding:calc(2px + env(safe-area-inset-top)) 8px 2px;gap:6px;min-height:0;flex-wrap:nowrap}
  .brand{font-size:13px;white-space:nowrap}.brand span{display:none}.brand .info{display:none}
  #hud{font-size:11px;gap:6px;flex-wrap:nowrap;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-right:44px}
  header nav{display:none;position:fixed;top:calc(30px + env(safe-area-inset-top));left:6px;right:6px;z-index:30;flex-direction:row;flex-wrap:wrap;gap:6px;background:var(--panel);border:1px solid var(--gold);border-radius:10px;padding:8px;max-height:calc(100dvh - 80px);overflow:auto;box-shadow:0 10px 30px rgba(0,0,0,.6)}
  body.nav-open header nav{display:flex}
  header nav button,header nav select{min-height:38px;flex:1 1 30%;font-size:13px;padding:4px 6px}
  header nav #audio-ctl{flex:1 1 100%;display:flex;justify-content:space-between;margin:0}header nav #audio-ctl input{flex:1;width:auto;min-width:0}header nav #audio-ctl button{flex:none;min-height:34px}
  #nav-toggle{display:block;position:fixed;top:calc(2px + env(safe-area-inset-top));right:6px;z-index:31;min-width:44px;min-height:28px;padding:0 10px;font-size:17px;line-height:1;background:var(--panel2);border:1px solid var(--gold);border-radius:6px;color:var(--text)}
  #stage .gl{touch-action:none}
  /* top-left: vitals / dock / buffs / target */
  #vitals{left:6px;top:6px;width:calc(100vw - 136px);max-width:230px;padding:3px 6px}#vitals .who{font-size:11px;margin-bottom:1px}#avatar{width:38px;height:38px;border-width:2px}#vitals .bar{height:12px;margin-top:2px}#vitals .bar span{font-size:9px;line-height:12px}
  #minimap{top:6px;right:6px;padding:2px;width:106px}#minimap canvas{width:100px!important;height:72px!important}#minimap .mm-bar{height:24px;justify-content:flex-end;font-size:9px;padding:0 1px 2px}#minimap .mm-bar>span:first-child{display:none}#minimap #mm-size{font-size:12px;padding:0 4px;min-width:22px;min-height:20px}#minimap #mm-world{font-size:10px;padding:0 3px;white-space:nowrap}#minimap .cam-zoom{display:none}#na-mini{font-size:9px!important;padding:1px 3px!important;margin-top:2px}
  #dock{display:none;top:158px;left:6px;right:6px;width:auto;max-width:none;padding:3px 5px;gap:4px;font-size:11px;border-radius:8px}body.dock-open #dock{display:flex}#dock select,#dock input{padding:2px 4px;font-size:12px;min-height:28px}#dock .mapsel{flex:1 1 100%;display:flex;gap:4px;align-items:center;min-width:0}#dock .mapsel select{max-width:none;flex:1;min-width:0}#dock #char-select{max-width:none;flex:1 1 30%;min-width:0}
  .npcsearch{flex:1 1 55%;min-width:0}.npcsearch input{width:auto;flex:1;min-width:0}.npcsearch button{min-width:34px;min-height:28px}#dock #map-info{display:none}
  #npc-list{width:min(300px,calc(100vw - 20px));max-height:42vh}
  #dock #npc-card{flex:1 1 100%;flex-wrap:wrap}#dock #npc-card button{padding:5px 12px;min-height:30px}
  #targetf{left:6px;top:230px;bottom:auto;position:absolute;width:150px;margin-top:0;font-size:11px;padding:3px 6px}
  #vitals>#buffbar{left:0;top:calc(100% + 4px);max-width:calc(100vw - 12px)}#buffbar .bf{width:28px;height:28px}#buffbar .bf img{width:24px;height:24px}
  #questtrack{left:auto;right:6px;top:270px;width:116px;font-size:10px;padding:3px 5px}
  /* bottom: chat / actions / hotbar */
  #side{left:130px;right:6px;bottom:110px;width:auto;height:92px;border-radius:8px}#side #chat{font-size:11px;padding:3px 5px 3px 24px}#chat-toggle{font-size:13px;left:2px;top:2px}#chat-in{padding:2px 3px}#chat-in select,#chat-in input{font-size:12px;padding:1px 4px;min-height:24px}
  body.chat-min #side{height:28px}
  #footnote{display:none}
  #actions{left:6px;bottom:16px;right:52px;padding:3px;gap:3px}#actions button{flex:1;padding:6px 2px;font-size:11px;min-height:32px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#actions kbd{display:none}
  #expbar{height:11px;bottom:calc(0px + env(safe-area-inset-bottom))}#expbar span{font-size:8px;line-height:11px}
  #hb-toggle{display:block;position:absolute;right:6px;bottom:16px;z-index:9;width:42px;height:40px;padding:0;font-size:20px;background:rgba(27,22,16,.94);border:1px solid var(--gold);color:#ffd23a}
  #nav-toggle,#dock-toggle,#skills-fab,#res-toggle,#bag-fab,#gm-fab{position:absolute;display:block;left:8px;right:auto;z-index:12;width:42px;height:42px;min-width:42px;min-height:42px;padding:0;border-radius:50%;font-size:20px;line-height:1}
  #nav-toggle{top:250px;background:rgba(27,22,16,.94);border:2px solid #e4bd69;color:#fff4cf;box-shadow:0 3px 12px #000}
  #dock-toggle{top:300px;background:rgba(27,22,16,.94);border:2px solid #e4bd69;color:#fff4cf;box-shadow:0 3px 12px #000}
  #skills-fab{top:350px}
  #res-toggle{top:400px}
  #bag-fab,#gm-fab{background:rgba(27,22,16,.94);border:2px solid #e4bd69;color:#fff4cf;box-shadow:0 3px 12px #000;font-size:15px;font-weight:700}#bag-fab{top:450px;font-size:20px}#gm-fab{top:500px}
  header nav button[data-win=inv],header nav button[data-win=gm]{display:none}
  #hotbar{display:flex;left:6px;right:6px;bottom:62px;width:auto;align-items:center;z-index:7;padding:3px;background:rgba(10,8,6,.88)}body.hb-open #hotbar{display:flex}
  body:not(.hb-open) #hotbar .hrow:not(:last-child){display:none}
  body.hb-open #side{display:none}body.hb-open #stage #joy{bottom:250px}
  #hotbar .hrow{justify-content:center;width:100%}#hotbar .slot{width:min(37px,10.4vw);height:min(37px,10.4vw)}#hotbar .slot img{width:calc(100% - 2px);height:calc(100% - 2px)}#hotbar .hrow u{width:14px;font-size:8px}#hotbar .slot b{font-size:8px}
  #selskill{display:none}#gasbar{right:6px;bottom:238px;width:62px}
  #deadmsg{font-size:15px;padding:10px 14px;width:80%;text-align:center}
  /* windows */
  .fwin{top:calc(32px + env(safe-area-inset-top))!important;left:4px!important;right:4px!important;bottom:auto!important;width:auto!important;max-height:calc(100dvh - 44px)}
  .fwin .win-head{font-size:15px;padding:6px 10px}.fwin .win-head button{min-width:34px;min-height:30px}.fwin .fbody{padding:6px}
  .box.win,.box.win.jx-char,.box.win.jx-bag{height:calc(100dvh - 20px)!important;max-width:100%}.modal{padding:6px}.box{padding:12px;max-height:92dvh}.box.win.wm{width:100%;height:calc(100dvh - 20px)}
  #eq-root{flex-direction:column}.jx-side{flex-direction:row;width:auto;flex-wrap:wrap}.jx-tab{flex:1;font-size:14px;padding:6px}.jx-detail{margin:0;font-size:15px}
  .jx-main{padding:6px}.jx-stage{gap:4px}.jx-slot{width:46px;height:46px}.jx-slot.mini{width:34px;height:34px}.jx-mid{min-width:0}.jx-mid img{max-height:200px}.jx-foot{gap:10px;font-size:13px;flex-wrap:wrap}.jx-lines{font-size:12px}.jx-name{font-size:13px}
  .jx-bagtop{flex-wrap:wrap}.jx-grid{grid-template-columns:repeat(5,minmax(0,1fr));width:calc(100% - 52px)}.jx-grid .jx-slot{width:100%;aspect-ratio:1;height:auto}.jx-bagtabs button{width:40px;height:56px}.jx-menu{flex-direction:row;flex-wrap:wrap;flex:1 1 100%}.jx-menu button{height:40px;flex:1 1 30%;font-size:13px}.jx-money>div{font-size:13px;padding:4px 6px}.jx-info{min-height:0}.jx-btns button{font-size:13px;padding:5px 9px;margin-left:3px}
  #fdetail{width:min(330px,calc(100vw - 12px))!important;left:6px!important;top:auto!important;bottom:60px!important;max-height:60dvh;font-size:14px}
  #itemtip{max-width:min(290px,calc(100vw - 16px));font-size:12px}
  .form{grid-template-columns:90px 1fr}.form>:nth-child(3){grid-column:1/-1}
  #panel:not([hidden]){left:6px;right:6px;top:34px;width:auto;max-height:78dvh}
  #wm-root{display:grid;grid-template-rows:minmax(0,1fr) auto;gap:0}#wm-side{width:100%;max-height:29dvh}
  #toast{top:40px;max-width:92vw;text-align:center}
  .grid{grid-template-columns:repeat(auto-fill,minmax(58px,1fr))}
  #stage #joy{display:block;left:14px;bottom:158px;width:104px;height:104px}
  .box.win.wm{padding:0}#wm-main{min-height:0}#wm-search{width:min(52%,260px)}
}
#joy i{position:absolute;left:50%;top:50%;width:44px;height:44px;margin:-22px 0 0 -22px;border-radius:50%;background:radial-gradient(circle at 40% 35%,#f3dea0,#b8913a);border:2px solid #7a6a3c;box-shadow:0 2px 8px rgba(0,0,0,.6);pointer-events:none}
/* iOS zooms the whole page when focusing controls below 16px, then may leave the
   WebGL canvas at the keyboard viewport scale. Keep editable controls at 16px. */
@media (pointer:coarse){input:not([type="range"]),textarea,select{font-size:16px!important}}
#joy{display:none;position:absolute;left:14px;bottom:158px;z-index:6;width:104px;height:104px;border-radius:50%;background:rgba(10,8,6,.35);border:2px solid rgba(233,212,154,.55);touch-action:none;-webkit-user-select:none;user-select:none}
/* Keep the landscape-phone controls above later base declarations. */
@media (max-height:560px){#stage #joy{display:block;left:14px;bottom:116px;width:92px;height:92px}#res-toggle{right:8px;top:112px}}
@media (max-height:560px) and (pointer:coarse){#stage #joy{left:calc(env(safe-area-inset-left) + 30px)}}

/* Touch phones in landscape: one compact control rail beside a small minimap.
   The map/NPC selector is a popover opened by the second rail button. */
@media (max-height:560px) and (pointer:coarse) and (orientation:landscape){
  #minimap{top:4px;right:6px;width:154px;padding:2px}#minimap canvas{width:148px!important;height:92px!important}#minimap .mm-bar{height:22px;font-size:9px;padding:0 2px}#minimap #mm-size{font-size:12px;padding:0 4px;min-width:22px;min-height:20px}#minimap #mm-world{font-size:9px;padding:0 3px;white-space:nowrap}#minimap .cam-zoom{display:none}#na-mini{font-size:9px!important;padding:1px 3px!important;margin-top:2px}
  #nav-toggle,#dock-toggle,#skills-fab,#res-toggle,#bag-fab,#gm-fab{position:absolute;display:block;left:auto;right:168px;z-index:12;width:40px;height:40px;min-width:40px;min-height:40px;padding:0;border-radius:50%;font-size:19px;line-height:1;border:2px solid #e4bd69;box-shadow:0 2px 8px #000}
  #nav-toggle{top:4px;background:rgba(27,22,16,.94);color:#fff4cf}#dock-toggle{top:48px;background:rgba(27,22,16,.94);color:#fff4cf}#skills-fab{top:92px}#res-toggle{top:136px}#bag-fab,#gm-fab{background:rgba(27,22,16,.94);color:#fff4cf;font-size:15px;font-weight:700}#bag-fab{top:180px;font-size:19px}#gm-fab{top:224px}
  header nav button[data-win=inv],header nav button[data-win=gm]{display:none}
  #dock{display:none;top:4px;left:auto;right:216px;width:min(420px,calc(100vw - 430px));max-width:none;padding:4px 6px;gap:4px;font-size:10px;background:rgba(10,8,6,.92)}body.dock-open #dock{display:flex}#dock .mapsel{flex:1 1 100%;display:flex;min-width:0}#dock .mapsel select{flex:1;max-width:none;min-width:0}.npcsearch{flex:1;min-width:0}.npcsearch input{width:auto;flex:1;min-width:0}#dock #map-info{display:none}
  #questtrack{left:12px;right:auto;top:145px;width:190px}
}

/* ---- control rail: text + small emoji pills (replaces the round icon buttons) ---- */
#nav-toggle,#dock-toggle,#skills-fab,#res-toggle,#bag-fab,#gm-fab{width:auto!important;min-width:0!important;height:32px!important;min-height:32px!important;padding:0 11px!important;border-radius:16px!important;font-size:13px!important;font-weight:600;line-height:30px;white-space:nowrap;display:inline-flex;align-items:center;gap:4px}
#nav-toggle i,#dock-toggle i,#skills-fab i,#res-toggle i,#bag-fab i,#gm-fab i{font-style:normal;font-size:12px;line-height:1}
#nav-toggle,#dock-toggle,#bag-fab,#gm-fab{display:none}
#skills-fab,#res-toggle{right:12px;left:auto;top:250px}#res-toggle{top:288px}
@media (max-width:760px) and (orientation:portrait){
  #nav-toggle,#dock-toggle,#skills-fab,#res-toggle,#bag-fab,#gm-fab{display:inline-flex;left:8px;right:auto}
  #nav-toggle{top:250px}#dock-toggle{top:288px}#skills-fab{top:326px}#res-toggle{top:364px}#bag-fab{top:402px}#gm-fab{top:440px}
}
@media (max-height:560px) and (pointer:coarse) and (orientation:landscape){
  #nav-toggle,#dock-toggle,#skills-fab,#res-toggle,#bag-fab,#gm-fab{display:inline-flex;left:auto;right:168px}
  #nav-toggle{top:4px}#dock-toggle{top:40px}#skills-fab{top:76px}#res-toggle{top:112px}#bag-fab{top:148px}#gm-fab{top:184px}
}
@media (max-height:560px){#nav-toggle{display:inline-flex}}

/* ---- touch layouts: every popup opened from the control rail is full screen with a close button top-right ---- */
.pop-close{display:none}
@media (max-width:760px) and (orientation:portrait),(max-height:560px) and (pointer:coarse) and (orientation:landscape){
  #win{padding:0;z-index:1000}
  .box.win,.box.win.jx,.box.win.jx-char,.box.win.jx-bag,.box.win.land-win,.box.win.wm{position:fixed!important;inset:0!important;width:100vw!important;max-width:none!important;height:100dvh!important;max-height:none!important;min-height:0!important;border-radius:0!important;border-width:0!important}
  .win-head{position:sticky;top:0;z-index:2;padding:calc(6px + env(safe-area-inset-top)) 10px 6px 14px;min-height:46px}
  #win-close,.fwin .win-head button,.pop-close,#res-panel .res-head button{min-width:44px;min-height:40px;font-size:18px;line-height:1}
  .fwin{position:fixed!important;inset:0!important;width:auto!important;max-width:none!important;height:auto!important;max-height:none!important;z-index:1000;border-radius:0;display:flex;flex-direction:column}.fwin[hidden]{display:none}.fwin .fbody{flex:1;overflow:auto}
  body.nav-open header nav,body.dock-open #dock{position:fixed!important;inset:0!important;top:0!important;left:0!important;right:0!important;bottom:0!important;width:auto!important;max-width:none!important;max-height:none!important;border-radius:0!important;z-index:1000;padding:calc(54px + env(safe-area-inset-top)) 12px 12px!important;overflow:auto;align-content:flex-start}
  body.nav-open header nav .pop-close,body.dock-open #dock .pop-close{display:block;position:fixed;top:calc(6px + env(safe-area-inset-top));right:8px;z-index:1001;background:var(--panel2);border:1px solid var(--gold);border-radius:8px;color:var(--text)}
  body.nav-open #nav-toggle,body.dock-open #dock-toggle{visibility:hidden}
  /* creative library on phones: a bottom sheet, so the map above stays visible and tappable for placing things */
  #res-panel{position:fixed!important;left:0!important;right:0!important;top:auto!important;bottom:0!important;width:auto!important;max-width:none!important;height:46dvh!important;z-index:1000;border-radius:14px 14px 0 0!important;padding-top:9px;overflow:auto}
  #res-panel .res-head{position:sticky;top:0;z-index:2}
}

/* ---- name plates use the original client sprite (z主界面\t图素\x血条.spr): its top strip is the name bar ---- */
#vitals .who,#targetf .who{display:flex;align-items:center;justify-content:space-between;gap:6px;height:22px;box-sizing:border-box;padding:0 26px 0 12px;margin-bottom:3px;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#f3e7c4;text-shadow:0 1px 0 #000,0 0 3px #000;background:url(assets/ui/frame-target0.png) 0 0/100% 48px no-repeat}
#vitals,#targetf{background:rgba(10,8,6,.5);border:0;padding:4px}
#vitals .who small,#targetf .who small{color:#d8c690}

/* ---- character / attributes on phones ---- */
.dhead{display:none}
@media (max-width:760px) and (orientation:portrait),(max-height:560px) and (pointer:coarse) and (orientation:landscape){
  #fdetail{position:fixed!important;inset:0!important;left:0!important;top:0!important;bottom:0!important;right:0!important;width:auto!important;height:auto!important;max-height:none!important;z-index:1001;border-radius:0;border-width:0;padding:0 14px 14px;font-size:16px}
  #fdetail .dhead{display:flex;position:sticky;top:0;z-index:2;justify-content:space-between;align-items:center;margin:0 -14px 8px;padding:calc(6px + env(safe-area-inset-top)) 10px 6px 14px;min-height:46px;background:linear-gradient(90deg,#0f6a66,#14504d);border-bottom:2px solid #b89a52;color:#fff;font-size:18px}
  #fdetail .dhead button{min-width:44px;min-height:40px;font-size:18px}
  .jx-detail{background:#0f4a47;color:#f3e7c4;border:2px solid #7a6a3c;border-radius:6px;padding:6px;font-size:14px;flex:1;text-align:center;margin:0}
  .jx-stage{align-items:stretch}.jx-col{justify-content:space-between}.jx-mid{min-height:240px}
  #fchar .fbody{-webkit-overflow-scrolling:touch}
}
@media (max-width:760px) and (orientation:portrait){
  .jx-mid img{max-height:none;max-width:130%;width:auto;height:auto;max-height:320px}
  .jx-slot{width:50px;height:50px}.jx-slot.mini{width:32px;height:32px}.jx-lines{font-size:13px}
}
@media (max-height:560px) and (pointer:coarse) and (orientation:landscape){
  .win-head{min-height:38px;padding-top:calc(3px + env(safe-area-inset-top));padding-bottom:3px;font-size:16px}
  #win-close,.fwin .win-head button{min-height:32px}
  #fchar .fbody{padding:6px}
  #eq-root{flex-direction:row;gap:6px}.jx-side{width:104px;gap:6px}.jx-tab{font-size:14px;padding:6px 4px}.jx-detail{flex:none}
  .jx-main{display:grid;grid-template-columns:1fr 200px;gap:0 8px;padding:6px}
  .jx-stage{grid-row:1/4;grid-column:1}.jx-foot,.jx-lines{grid-column:2;margin-top:2px}.jx-foot{flex-direction:column;gap:4px;font-size:13px}.jx-lines{font-size:12px}
  .jx-slot{width:40px;height:40px}.jx-slot.mini{width:30px;height:30px}.jx-col{gap:5px}.jx-mid{min-height:0}.jx-mid img{max-height:250px}
}
@media (max-width:760px) and (orientation:portrait),(max-height:560px) and (pointer:coarse) and (orientation:landscape){.jx-detail br{display:none}}

/* map arrival: veil while the first sheets stream in */
#stage.map-loading::after{content:"Đang tải bản đồ…";position:absolute;inset:0;z-index:6;display:flex;align-items:center;justify-content:center;background:rgba(10,8,6,.55);color:#f3e7c4;font-size:15px;letter-spacing:.3px;pointer-events:none}

/* "Nhận được ..." toast */
#gain{position:fixed;top:104px;left:50%;transform:translate(-50%,-6px);max-width:min(92vw,520px);background:rgba(14,10,6,.92);border:1px solid #e4bd69;color:#fff3cf;padding:7px 16px;border-radius:20px;font-size:14px;opacity:0;transition:opacity .25s,transform .25s;pointer-events:none;z-index:21;text-align:center;box-shadow:0 4px 18px rgba(0,0,0,.5)}
#gain.on{opacity:1;transform:translate(-50%,0)}#gain span{color:#e4bd69}#gain b{color:#ffe28a}

/* emote list */
.em-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(92px,1fr));gap:8px}
.em-grid .cell.em{min-height:78px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:13px;padding:6px 4px}
.em-grid .em-ico{font-size:26px;line-height:1}.em-grid .em-name{font-weight:600}.em-grid .cell.em small{font-size:11px;color:var(--gold)}

/* blacksmith enhance window */
.en{display:grid;grid-template-columns:minmax(150px,1fr) 1.3fr;gap:12px;min-height:300px}
.en-list{display:flex;flex-direction:column;gap:4px;overflow:auto;max-height:60vh;border:1px solid var(--line);border-radius:8px;padding:6px}
.en-it{display:flex;align-items:center;gap:8px;padding:4px 6px;border-radius:6px;cursor:pointer}.en-it.sel,.en-it:hover{background:var(--panel2);outline:1px solid var(--gold)}.en-it .ico{width:32px;height:32px}.en-it small{margin-left:auto;color:var(--gold);font-size:11px}
.en-main{display:flex;flex-direction:column;gap:8px}.en-sel{display:flex;gap:10px;align-items:center}.en-sel .ico{width:48px;height:48px}.gold{color:var(--gold)}
.en-odd{display:flex;justify-content:space-between}.en-bar{height:8px;background:var(--panel2);border-radius:4px;overflow:hidden}.en-bar i{display:block;height:100%;background:linear-gradient(90deg,#c9953a,#6fc06f)}
.en-mats{display:flex;flex-direction:column;gap:3px}.en-mats div{display:flex;justify-content:space-between;border-bottom:1px dotted var(--line);padding:2px 0}.en-mats .no b{color:#e0604c}.en-mats .ok b{color:#6fc06f}
.en-go{margin-top:4px;padding:10px;border-radius:8px;border:1px solid #e4bd69;background:linear-gradient(180deg,#e9c46a,#a8741f);color:#2b1c05;font-weight:800;cursor:pointer}.en-go:disabled{filter:grayscale(.8);cursor:not-allowed}
.en-hint{color:var(--dim)}.en-msg .ok{color:#6fc06f;font-weight:700}.en-msg .no{color:#e0604c;font-weight:700}.en-safe{font-size:13px}
@media (max-width:600px){.en{grid-template-columns:1fr}.en-list{max-height:30vh}}

/* enlarged minimap on phones */
@media (max-width:760px) and (orientation:portrait),(max-height:560px) and (pointer:coarse) and (orientation:landscape){
  #minimap.mm-big{width:auto;max-width:calc(100vw - 12px)}#minimap.mm-big canvas{width:min(300px,calc(100vw - 24px))!important;height:auto!important;aspect-ratio:440/380}#minimap.mm-big .mm-bar{height:26px;font-size:11px}#minimap.mm-big .mm-bar>span:first-child{display:inline}
  #minimap #mm-size,#minimap #mm-world{min-height:22px}
}

/* creative library: combos */
.res-tabs{display:flex;gap:6px;margin:6px 0}.res-tabs button{flex:1;padding:5px 8px;border-radius:8px;font-size:13px}.res-tabs button.on{background:var(--gold);color:#2b1c05;border-color:var(--gold);font-weight:700}
.res-item.combo{width:auto}.res-item .cb{position:relative;display:block;width:110px;height:84px;overflow:hidden}.res-item .cb .cp{position:absolute;overflow:hidden;display:block}.res-item .cb .cp img{position:absolute;max-width:none;image-rendering:auto}

#minimap canvas{touch-action:none}

/* GM window */
.gm-tabs{display:flex;flex-wrap:nowrap;overflow-x:auto;gap:4px;padding-bottom:6px;margin-bottom:10px;border-bottom:1px solid var(--line);-webkit-overflow-scrolling:touch}.gm-tabs button{flex:none;white-space:nowrap;padding:5px 11px;border-radius:14px;font-size:13px}.gm-tabs button.on{background:var(--gold);color:#2b1c05;border-color:var(--gold);font-weight:700}
.gm-sec{border:1px solid var(--line);border-radius:10px;padding:8px 10px;margin-bottom:10px}.gm-sec h4{margin:0 0 8px;font-size:13px;color:var(--gold);letter-spacing:.3px}
.gm-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:6px;margin-bottom:6px}.gmb{padding:8px 6px;border-radius:8px;font-size:13px;cursor:pointer}.gmb.on{background:#2f6a2f;color:#fff;border-color:#6fc06f}.gmb.warn{border-color:#e0604c;color:#e0604c}
.gm-row{display:flex;align-items:center;gap:10px;margin-top:6px}.gm-row input{flex:1}.gm-info{color:var(--dim);font-size:12px;margin:4px 0}
.gm-list{display:flex;flex-direction:column;gap:2px;max-height:52vh;overflow:auto}.gm-it{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:5px 4px;border-bottom:1px solid var(--line)}.gm-btns{display:flex;gap:4px;flex:none}.gm-btns button,.gm-it>button{padding:3px 8px;font-size:12px}
.gm-chk{display:flex;align-items:center;gap:4px;font-size:13px}.gm-out{background:var(--bg);border:1px solid var(--line);border-radius:6px;padding:6px 8px;min-height:2em;white-space:pre-wrap;font-size:12px}
#gl-code{width:100%;box-sizing:border-box;background:var(--bg);color:var(--text);border:1px solid var(--line);border-radius:8px;font:12px ui-monospace,monospace;padding:8px;margin-bottom:6px}
.gm-tbl{width:100%;border-collapse:collapse;font-size:12px}.gm-tbl td{border-bottom:1px solid var(--line);padding:2px 6px}.gm-tbl td:last-child{text-align:right;font-weight:600}
.gm-log{font:11px ui-monospace,monospace;padding:2px 4px;border-bottom:1px dotted var(--line);word-break:break-all}.gm-log.error{color:#e0604c}.gm-log b{margin-right:6px}

.gm-form{display:grid;grid-template-columns:110px 1fr;gap:8px 10px;align-items:center}.gm-form input,.gm-form select{width:100%;box-sizing:border-box;padding:7px 9px;border-radius:8px}
.gm-step{display:flex;gap:4px;align-items:center}.gm-step input{flex:1;min-width:0;text-align:center}.gm-step button{padding:6px 9px;border-radius:8px;font-size:12px;flex:none}
.gm-grid.sticky{position:sticky;bottom:-12px;background:linear-gradient(180deg,transparent,var(--panel) 30%);padding-top:10px}.gmb.run{background:linear-gradient(180deg,#e9c46a,#a8741f);color:#2b1c05;border-color:#e4bd69;font-weight:800}.gm-it.cur{background:var(--panel2)}
@media (max-width:600px){.gm-form{grid-template-columns:1fr}}
/* Lua editor */
.lua{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(250px,1fr);gap:12px}@media (max-width:760px){.lua{grid-template-columns:1fr}}
.lua-ed{position:relative;display:flex;height:260px;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:#14110e;color:#e8dcc4;font:12.5px/18px ui-monospace,Menlo,Consolas,monospace}
.lua-gutter{flex:none;width:38px;overflow:hidden;padding:8px 6px 8px 0;text-align:right;color:#6b6350;background:#1b1712;border-right:1px solid #2c261c;user-select:none}.lua-gutter div{height:18px}
.lua-wrap{position:relative;flex:1;min-width:0}.lua-hl,.lua-ta{position:absolute;inset:0;margin:0;padding:8px;border:0;font:inherit;line-height:18px;white-space:pre;overflow:auto;tab-size:2;box-sizing:border-box}.lua-hl{pointer-events:none;color:#e8dcc4}.lua-hl code{font:inherit}
.lua-ta{background:transparent;color:transparent;caret-color:#ffe28a;resize:none;outline:none;z-index:1}.lua-ta::selection{background:rgba(120,160,255,.35)}.lua-ta::placeholder{color:#6b6350}
.t-c{color:#7d8a6e;font-style:italic}.t-s{color:#e6b072}.t-n{color:#d6a6ff}.t-k{color:#ff8a76;font-weight:600}.t-f{font-style:normal}.k-api{color:#7fd88a}.k-stub{color:#e59a4a;text-decoration:underline dotted}.k-lib{color:#7db4ff}.k-std{color:#5ec5c5}.k-kw{color:#ff8a76}
.lua-ac{position:absolute;z-index:5;min-width:240px;max-width:320px;max-height:196px;overflow:auto;background:#241e15;border:1px solid #7a6a3c;border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.6)}.ac-it{display:flex;gap:6px;align-items:baseline;padding:3px 8px;cursor:pointer;white-space:nowrap;font-size:12px}.ac-it.sel,.ac-it:hover{background:#3a3020}.ac-it span{color:#9a9078;overflow:hidden;text-overflow:ellipsis;max-width:120px}.ac-it em{margin-left:auto;color:#6b6350;font-size:10px;font-style:normal}
.lua-sig{min-height:20px;padding:4px 2px;font:12px ui-monospace,monospace;color:var(--text)}.lua-sig u{color:#ffe28a;text-decoration:underline}.lua-sig em{color:#e59a4a;font-style:normal}.dim{color:var(--dim)}
.lua-bar{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin:4px 0}.lua-bar select{max-width:170px}.lua-bar small{opacity:.7;font-weight:400}
.lua-out{margin:6px 0 0;min-height:48px;max-height:140px;overflow:auto;background:#14110e;border:1px solid var(--line);border-radius:8px;padding:8px;font:12px ui-monospace,monospace;color:#cfc6a8;white-space:pre-wrap}.lua-out.ok{border-color:#3f7a3f;color:#9fe0a0}.lua-out.err{border-color:#a53a27;color:#ff9c8a}
.lua-lib{display:flex;flex-direction:column;gap:6px;min-width:0}.lua-lh{display:flex;justify-content:space-between;align-items:baseline}.lua-chips{display:flex;flex-wrap:wrap;gap:4px}.lua-chips button{padding:2px 8px;border-radius:12px;font-size:11px}.lua-chips button.on{background:var(--gold);color:#2b1c05;border-color:var(--gold)}
.lua-list{height:220px;overflow:auto;border:1px solid var(--line);border-radius:8px}.lib-it{display:flex;gap:6px;align-items:baseline;padding:3px 8px;cursor:pointer;font-size:12px;border-bottom:1px dotted var(--line)}.lib-it.sel,.lib-it:hover{background:var(--panel2)}.lib-it span{color:var(--dim);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.lib-it em{color:var(--dim);font-size:10px;font-style:normal}
.lua-det{border:1px solid var(--line);border-radius:8px;padding:8px;font-size:12px;min-height:80px}.det-h{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.badge{font-size:10px;border:1px solid currentColor;border-radius:8px;padding:0 6px}.det-sig{font:12px ui-monospace,monospace;margin:6px 0}.lib-code{margin:4px 0;padding:6px 8px;background:#14110e;color:#e8dcc4;border-radius:6px;cursor:pointer;white-space:pre-wrap;font:11.5px ui-monospace,monospace}.lib-code:hover{outline:1px solid var(--gold)}.warn{color:#e59a4a}

/* performance read-out */
#perf{position:absolute;z-index:3;font:10px/1.35 ui-monospace,Menlo,Consolas,monospace;color:#cfe3cf;opacity:.55;pointer-events:none;white-space:pre;text-shadow:0 1px 0 #000;text-align:right}#perf[hidden]{display:none}
@media (max-width:760px) and (orientation:portrait){#perf{font-size:8.5px}}

/* performance read-out: bright text on a dark translucent plate; a one-line strip that is always visible on phones (same look as the footnote) */
#perf{display:flex;flex-direction:column;opacity:1!important;color:#fff;background:rgba(0,0,0,.58);padding:3px 8px;border-radius:7px;text-shadow:0 1px 2px #000;font-weight:600}#perf span{display:block}
@media (max-width:760px) and (orientation:portrait),(max-height:560px) and (pointer:coarse) and (orientation:landscape){
  #perf{position:fixed!important;top:2px!important;right:6px!important;left:auto!important;bottom:auto!important;flex-direction:column;gap:0;max-width:150px;font-size:9px;line-height:1.25;padding:1px 6px;z-index:40;border:1px solid rgba(255,210,58,.4);white-space:nowrap}#perf span:nth-child(3){display:none}
}

/* tooltips and toasts must sit above the full-screen popups (z-index 1000) */
#itemtip{z-index:1100}#toast,#gain{z-index:1100}

/* Vào phái nhanh */
.join-sets{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:6px}.join-set{display:flex;flex-direction:column;gap:1px;border:1px solid var(--line);border-radius:10px;padding:7px 9px 7px 28px;position:relative;cursor:pointer}.join-set input{position:absolute;left:9px;top:10px}.join-set small{color:var(--dim)}.join-set.on{border-color:var(--gold);background:var(--panel2)}.join-set.weak{opacity:.6}
.gm-checks{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:6px}

/* GM menu: grid of tiles, a tile opens its detail screen */
.gm-menu{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.gm-tile{display:flex;flex-direction:column;align-items:flex-start;gap:3px;text-align:left;padding:12px 12px 10px;border-radius:12px;border:1px solid var(--line);background:var(--panel2);cursor:pointer;min-height:104px;transition:transform .12s,border-color .12s}
.gm-tile i{font-style:normal;font-size:26px;line-height:1}.gm-tile b{font-size:14px;color:var(--text)}.gm-tile small{font-size:11px;line-height:1.3;color:var(--dim)}
.gm-tile:hover,.gm-tile:active{border-color:var(--gold);transform:translateY(-1px)}.gm-tile:first-child{grid-column:1/-1;flex-direction:row;align-items:center;gap:12px;min-height:0;background:linear-gradient(90deg,rgba(228,189,105,.28),var(--panel2))}.gm-tile:first-child i{font-size:30px}.gm-tile:first-child small{margin-left:auto;max-width:48%}
.gm-dhead{display:flex;align-items:center;gap:10px;position:sticky;top:-12px;z-index:3;background:var(--panel);padding:6px 0 8px;margin-bottom:8px;border-bottom:1px solid var(--line)}.gm-dhead b{font-size:16px;color:var(--gold)}.gm-dhead button{padding:5px 10px;border-radius:8px}
@media (max-width:600px){.gm-menu{grid-template-columns:repeat(2,1fr)}.gm-tile{min-height:96px}}

/* embedded (?embded=zalo): see the corner rules at the end of the file */


/* ---- embedded in an iframe (?embded=zalo): the host floats a button over the bottom-right corner -> keep a 66 x 76 px corner clear ---- */
html.embed-zalo{--ezw:66px;--ezh:76px;background:transparent}
html.embed-zalo #expbar{right:var(--ezw)!important}
html.embed-zalo #hotbar{transform:translateY(calc(-1 * var(--ezh)))}
@media (max-width:760px) and (orientation:portrait){
  html.embed-zalo #actions,html.embed-zalo #hb-toggle,html.embed-zalo #side{transform:translateY(calc(-1 * var(--ezh)))}
  html.embed-zalo .dlg-dock{bottom:calc(8px + var(--ezh))}
}
@media (max-width:760px) and (orientation:portrait),(max-height:560px) and (pointer:coarse) and (orientation:landscape){
  html.embed-zalo .box.win,html.embed-zalo .box.win.jx,html.embed-zalo .box.win.jx-char,html.embed-zalo .box.win.jx-bag,html.embed-zalo .box.win.land-win,html.embed-zalo .box.win.wm{inset:0 0 var(--ezh) 0!important;height:auto!important}
  html.embed-zalo .fwin,html.embed-zalo #fdetail,html.embed-zalo body.nav-open header nav,html.embed-zalo body.dock-open #dock{bottom:var(--ezh)!important}
}
html.embed-zalo .dlg-dock{padding-right:calc(8px + var(--ezw))}

html.embed-zalo #res-panel{bottom:var(--ezh)!important}
@media (max-width:760px) and (orientation:portrait){html.embed-zalo #stage #joy{transform:translateY(calc(-0.7 * var(--ezh)))}}

/* embedded: floating windows on desktop / landscape never reach the reserved corner */
@media (min-width:761px),(orientation:landscape){html.embed-zalo .fwin{max-height:calc(100dvh - 130px - var(--ezh))!important;overflow:auto}}
