/* Ghép giao diện Tam Giới vào Phong Thần Idle */
html,body{height:100%;overflow:hidden;background:#141008}
#app{max-width:none;height:100dvh;margin:0;display:block;background:none;box-shadow:none}
.game-shell #arena{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;cursor:crosshair}
.game-shell .bar{overflow:visible}
#legacy{display:none!important}
/* cửa sổ cũ (chờ chuyển sang kiểu Tam Giới) nổi giữa màn hình */
#panel{position:fixed!important;z-index:40;left:50%!important;top:50%!important;right:auto!important;transform:translate(-50%,-50%);width:min(560px,94vw);max-height:84dvh;display:none;overflow:auto;background:#17120bf2;border:1px solid #b98b40;border-radius:4px;box-shadow:inset 0 0 0 2px #3d2c13,0 6px 24px #000c;padding:0 10px 10px}
body.wopen #panel{display:block}
#panel.pcm{background:none;border:0;box-shadow:none;padding:0;width:auto;max-height:none;overflow:visible}
#panel .wtitle{position:sticky;top:0;z-index:2;display:flex;justify-content:space-between;align-items:center;padding:6px 2px;background:#17120b;border-bottom:1px solid #a8873e;color:#e8d399;font:bold 15px TGPC,serif}
#panel .wtitle button{min-height:0;width:26px;height:26px;padding:0}
#pcLayer{z-index:45}#modal{z-index:50}#uiTip{z-index:60}
#banner{position:absolute;left:50%;top:22%;transform:translateX(-50%);z-index:3;pointer-events:none}
.game-shell .mini-wrap canvas#tgMini{position:absolute;inset:0;width:100%;height:100%;border:0;background:#1b2214}
.game-shell .daily-quest-list li[data-complete=true] b{color:#8fdc6a}
.game-shell .chat-content .chat-message{margin:2px 0}
.game-shell .chat-content .chat-sys{color:#f0c86a}
#mapPanel.tg-mappanel:not(.hidden){display:block}
#mapPanel.tg-mappanel{left:auto;bottom:auto;position:absolute;z-index:30;right:180px;top:8px;width:min(330px,70vw);max-height:80dvh;overflow:auto;padding:6px;border:1px solid #b98b40;border-radius:3px;background:#120e08f2;box-shadow:inset 0 0 0 2px #3d2c13,0 4px 18px #000a;font:12px TGPC,serif;color:#e4d5a4}
.tg-mappanel button{min-height:0;padding:3px 6px;border-radius:2px;font-size:11px}
.tg-mappanel .mgrp{margin:4px 0}.tg-mappanel .gh{display:flex;width:100%;gap:6px;align-items:center;justify-content:space-between}
.tg-mappanel .chips{display:flex;flex-wrap:wrap;gap:3px;margin-top:3px}.tg-mappanel .chip.on,.tg-mappanel .mgrp.cur>.gh{border-color:#f3d28a;background:#4a371b}
.tg-mappanel .mp-head{display:flex;justify-content:space-between;align-items:center;color:#efda95;font-weight:bold;padding:2px 2px 6px;border-bottom:1px solid #6e5a30}
#townBar{position:absolute;z-index:6;left:50%;transform:translateX(-50%);top:6px;display:flex;flex-wrap:wrap;gap:4px;align-items:center;justify-content:center;max-width:min(640px,62vw);padding:4px 6px;border:1px solid #b98b40;border-radius:3px;background:#120e08e6;font:12px TGPC,serif}
#townBar b{color:#ffdfa0;margin-right:4px}#townBar button{min-height:0;padding:3px 7px;border-radius:2px;font-size:11px}
.tg-dlg{position:fixed;z-index:42;left:50%;top:50%;transform:translate(-50%,-50%);min-width:min(300px,92vw);max-width:94vw;max-height:84dvh;overflow:auto;padding:30px 10px 10px;border:1px solid #bd9a45;border-radius:3px;background:#080b07f7;box-shadow:inset 0 0 0 3px #3d2c13,0 4px 18px #000c;font:12px/1.4 TGPC,serif;color:#e4d5a4}
.tg-dlg>h2{position:absolute;left:3px;right:3px;top:3px;height:25px;margin:0;display:grid;place-items:center;border-bottom:1px solid #a8873e;background:linear-gradient(100deg,#20180d,#2a2114,#16130b);font-size:15px;color:#e8d399}
.tg-dlg>.ui-close{position:absolute;right:5px;top:4px;width:23px;height:23px;min-height:0;padding:0;font:20px/18px Georgia,serif}
.tg-dlg .tg-list{display:flex;flex-direction:column;gap:4px}.tg-dlg .tg-list button{min-height:30px;border-radius:2px;padding:4px 8px;font-size:12px;text-align:center}
.tg-dlg .tg-list button.on{border-color:#f3d28a;background:#4a371b;color:#fff0b7}
.tg-dlg .tg-sub{color:#a99c78;font-size:10px;margin:2px 0 6px}
.game-shell .effect-bar img.effect-icon{width:24px;height:24px}
.game-shell .effect-bar .tg-eff{position:relative;display:inline-block}.game-shell .effect-bar .tg-eff time{position:absolute;left:0;right:0;bottom:-11px;text-align:center;font:9px TGPC,serif;color:#f6e6b0}
.game-shell .native-skill-cell img.hand-skill-icon{position:absolute;left:11px;top:6px;width:32px;height:32px;pointer-events:none}
.game-shell .quick img{width:28px;height:28px}
.game-shell #meditate[aria-pressed=true],.game-shell [data-native-key=Auto][aria-pressed=true],.game-shell [data-native-key=Ride][aria-pressed=true]{filter:drop-shadow(0 0 4px #ffd36a)}
body:not(.wopen) #panel{display:none!important}
.game-shell .mini-wrap{position:relative;height:115px}
.game-shell .minimap.collapsed .mini-wrap{display:none}
#toast{padding:0;border:0;background:none;box-shadow:none;display:flex;flex-direction:column;gap:4px;align-items:center;pointer-events:none}
#toast:empty{display:none}
#toast>div{padding:7px 14px;border:1px solid #e4be73;border-radius:4px;background:#21190af2;color:#ffe3a1;font:13px TGPC,serif;box-shadow:0 3px 12px #0008}
.cs-node img{width:32px;height:32px;flex:none;border:1px solid #705c2f;box-sizing:content-box;filter:grayscale(1) brightness(.55)}
.cs-node.learned img{filter:none}
.cs-detail-heading{display:flex;gap:8px;align-items:center}.cs-detail-heading img{width:32px;height:32px;border:1px solid #9b803d}
.cs-detail-heading small{display:block;color:#a99e7c;font-size:10px}
.character-skill-window .cs-detail-actions button{padding:3px 8px}
.character-skill-window .cs-node[aria-pressed=true]{outline:1px solid #d7b35c}
/* Kỳ Trân Các gộp + menu Nâng cấp (turn 10) */
#tgKtc{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);z-index:44;display:flex;flex-direction:column;max-height:calc(100dvh - 90px)}
#tgKtc .ktc-good-icon img{max-width:32px;max-height:32px;object-fit:contain;image-rendering:pixelated}
#tgKtc .ktc-buy-row>button.poor{opacity:.55}
#tgKtc footer p b{color:#ffe095}
#tgKtc .ktc-tabs button{padding:2px 1px;font-size:11.5px}
.tg-menu{z-index:46;width:min(330px,calc(100vw - 24px))}
.tg-menu .newcomer-content{position:static;display:grid;gap:4px;max-height:calc(100dvh - 180px);overflow-y:auto}
.tg-menu .newcomer-content button{min-height:34px;padding:4px 8px}
.tg-menu .tg-back{opacity:.8}
.tg-menu-note{margin:2px 2px 6px;font-size:12px;line-height:1.45;color:#d8c99a}
.game-shell:has(#effectBar:not(:empty)) .mission-panel{top:calc(var(--mission-top) + 22px + (var(--eff-rows, 1) - 1) * 38px)}
#pcLayer .pcw .opts .opt,.pcw .opts button.opt{min-height:0!important;height:auto!important;padding:1px 2px!important;margin:0!important;line-height:17px!important;border:0!important;background:none!important;box-shadow:none!important;text-align:left!important;justify-content:flex-start!important}
/* Túi đồ kiểu Tam Giới (js/tgbag.js) */
:root{--r4:#5fe07a}
#tgBag{position:fixed;right:6px;top:6px;z-index:31}
#tgBag .inventory-stage{transform-origin:top left}
#tgBag .inventory-cell{opacity:1!important;display:grid;place-items:center;padding:3px!important;cursor:pointer}
#tgBag .inventory-cell img{max-width:34px;max-height:34px}
#tgBag .inventory-cell.bag-empty{cursor:default;opacity:.85!important}
#tgBag .inventory-cell.q1{outline-color:#6fa8ff}#tgBag .inventory-cell.q2{outline-color:#c58cff}#tgBag .inventory-cell.q3{outline-color:#f2c14e}#tgBag .inventory-cell.q4{outline-color:#5fe07a;box-shadow:inset 0 0 8px #5fe07a55}
#tgBag .inventory-cell.bag-up::before{content:"▲";position:absolute;right:2px;bottom:1px;color:#7ee08a;font-size:10px;z-index:3;text-shadow:0 0 2px #000}
#tgBag .inventory-cell.bag-lock::before{content:"🔒";position:absolute;right:1px;top:1px;font-size:9px;z-index:3}
#tgBag .bag-selling .inventory-cell:not(.bag-empty):hover{outline:2px solid #ff9a5a;background:#3a1f12}
#tgBag .bag-selling .inventory-grid{box-shadow:0 0 0 2px #c8642e}
#tgBag .bag-sell-tag{font-style:normal;color:#ff9a5a;font-size:12px}
#tgBag .inventory-equip-slot.equipped.r4{box-shadow:inset 0 0 10px #5fe07a66}
#tgBag .inventory-equip-slot .bag-en{position:absolute;right:2px;bottom:1px;color:#ffe08a;font-size:10px}
#tgBag .bag-actions2{grid-template-columns:2fr 1fr}
#tgBag .bag-actions2 select{height:28px;background:#17130a;color:#e4d5a4;border:1px solid #a8873e;font:13px 'TG Vietnamese Serif',Georgia,serif;padding:0 4px}
#tgBag [data-act=sell][aria-pressed=true]{background:linear-gradient(#8a3c18,#4a1e0b);color:#fff2c0;box-shadow:0 0 8px #ff9a5a99}
#tgBag .inventory-notice{position:absolute;top:100%;left:0;right:0;width:auto;height:auto;max-width:none;clip-path:none;white-space:normal;margin:3px 0 0;padding:4px 6px;background:#100f09ee;border:1px solid #66502b;color:#dfc993;font:11px/1.4 'TG Vietnamese Serif',Georgia,serif}
#tgBag .inventory-actions button,#tgBag .inventory-auto-sale{font-size:12.5px!important;white-space:nowrap;padding:0 3px!important}
#tgBag .inventory-equip-slot>img{width:auto!important;height:auto!important;max-width:62%!important;max-height:62%!important;image-rendering:pixelated}
#tgBag .inventory-equip-slot[data-slot=treasure]>img,#tgBag .inventory-equip-slot[data-slot=artifact]>img{max-width:80%!important;max-height:80%!important}
#tgBag .inventory-cell img{max-width:30px!important;max-height:30px!important}
#tgBag .inventory-equip-slot{display:grid!important;place-items:center!important}
#tgBag .inventory-equip-slot>img{margin:auto;justify-self:center;align-self:center}
#tgBag .bag-actions2{grid-template-columns:minmax(0,2fr) minmax(0,1fr)!important}
#tgBag .bag-actions2 select{width:100%;min-width:0}
#tgBag .inventory-equip-slot>img{position:static!important;left:auto!important;top:auto!important}
#tgBag .inventory-equip-slot>img{width:64%!important;height:64%!important;max-width:64%!important;max-height:64%!important;object-fit:contain}
#tgBag .inventory-equip-slot[data-slot=treasure]>img,#tgBag .inventory-equip-slot[data-slot=artifact]>img{width:78%!important;height:78%!important;max-width:78%!important;max-height:78%!important}
#uiTip .tip,.modal .tip,.tip{text-align:center}#uiTip .tip>div,.tip>div{text-align:center}
html,body{background:#0d0b09!important}
/* tổ đội đồng hành */
.character-skill-window .cs-party{margin-top:3px;padding:2px 6px;font-size:10px;color:#f2e3a0;border-color:#a8873e;background:#3a2c12}
.party-list{gap:4px}
.party-row{display:flex;gap:6px;align-items:center;padding:5px 6px;border:1px solid #54482a;background:#0e120a}
.party-row .pi{flex:1;min-width:0;display:flex;flex-direction:column}
.party-row b{color:#a8e564}.party-row span{color:#cdbb8f;font-size:11px}
.party-row.main{border-color:#d7b35c;background:#29220f}
.tg-dlg .party-row button{width:auto!important;flex:none;margin:0;padding:4px 8px;font-size:11px}
/* Kỹ năng: tab nhân vật trong tổ đội (như JX) */
.cs-char-tabs{position:absolute;top:36px;left:9px;right:9px;display:flex;gap:3px}
.character-skill-window .cs-char-tabs button{flex:1;min-width:0;height:22px;padding:1px 3px;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:#15190f}
.character-skill-window .cs-char-tabs [aria-selected=true]{border-color:#9fd56a;background:#24361a;color:#d8ffb0}
.cs-has-chars .cs-tree-tabs{top:68px}.cs-has-chars .cs-assign-hint{top:108px}.cs-has-chars .cs-tree{top:186px}.cs-has-chars .cs-skill-detail{top:108px}
.character-skill-window .cs-node{position:relative}.cs-skxp{position:absolute;left:5px;right:5px;bottom:3px;height:3px;background:#2a2414;border:1px solid #4a3d1f}.cs-skxp b{display:block;height:100%;background:#7fd46a}
/* bản đồ lớn */
#bigMap{position:fixed;z-index:45;left:50%;top:50%;transform:translate(-50%,-50%);width:min(980px,96vw);height:min(720px,90dvh);display:flex;flex-direction:column;border:1px solid #bd9a45;border-radius:3px;background:#080b07f7;box-shadow:inset 0 0 0 3px #3d2c13,0 6px 24px #000c;font:12px/1.4 TGPC,serif;color:#e4d5a4}
#bigMap header{display:flex;gap:8px;align-items:center;padding:6px 8px;border-bottom:1px solid #a8873e;background:linear-gradient(100deg,#20180d,#2a2114,#16130b)}
#bigMap header strong{font-size:15px;color:#e8d399;white-space:nowrap}#bigMap header select{max-width:240px}#bigMap header input{width:76px;flex:none}#bigMap header button{white-space:nowrap;flex:none}#bigMap #bmXY{min-width:70px;color:#9fd8ff}
#bigMap header select,#bigMap header input{background:#15120b;color:#e4d5a4;border:1px solid #7d6837;font:inherit;padding:2px 4px}
#bigMap header button{background:#241c10;color:#e4d5a4;border:1px solid #7d6837;font:inherit;padding:2px 8px;cursor:pointer}
#bigMap header .ui-close{margin-left:auto;width:24px;height:24px;padding:0;font:20px/18px Georgia,serif}
#bigMap canvas{flex:1;width:100%;min-height:0;cursor:crosshair}
#bigMap footer{padding:4px 8px;color:#a99c78;font-size:11px;border-top:1px solid #54482a}
#mini,.minimap canvas{cursor:zoom-in}
/* chuỗi chiêu Đạo Sĩ */
#t-sys .combo{margin:6px 0 10px;padding:6px 8px;border:1px solid #54482a;background:#0e120a}
#t-sys .combo-h{margin-bottom:4px;color:#a8e564}
#t-sys .combo select{max-width:260px;background:#15120b;color:#e4d5a4;border:1px solid #7d6837;font:inherit}

/* thanh bùa lợi: không giới hạn, 8 biểu tượng mỗi hàng */
.effect-bar{width:auto!important;height:auto!important;grid-template-columns:repeat(8,24px)!important;row-gap:14px!important;column-gap:4px!important}
.game-shell .daily-quest-list li:first-child{cursor:pointer}
.game-shell .daily-quest-list li[data-complete=no] b{color:#ff4141}.game-shell .daily-quest-list li[data-complete=true] b{color:#45ff54}
