#panel[data-native-panel="enchant"]{width:min(450px,calc(100vw - 32px));max-height:calc(100dvh - 48px);padding:12px 18px 14px;background:#1a2019 url('/assets/ui/native-detail-wood.png') repeat;border:2px solid #998158;border-radius:12px;box-shadow:inset 0 0 0 2px #352b1b,0 8px 28px #0009;color:#e4d7b7;overflow:hidden}
#panel[data-native-panel="enchant"] #panel-body{max-height:calc(100dvh - 110px);overflow:auto}
#panel[data-native-panel="enchant"] #panel-title{font-size:17px;margin:0;color:#e7dabb;text-shadow:1px 2px #19150d}
.equipment-enchant{font-size:13px;line-height:1.5;padding:8px 2px}
.enchant-selection{display:grid;grid-template-columns:1fr;gap:8px}.enchant-selection label{display:flex;align-items:center;gap:8px}.enchant-selection select{flex:1;min-width:0;background:#131a15;color:#e5dabd;border:1px solid #8b7850;border-radius:3px;padding:6px;font-size:13px}
.enchant-preview{display:flex;align-items:center;justify-content:center;gap:10px;margin:10px 0;padding:6px;border-top:1px solid #8a79515c;border-bottom:1px solid #8a79515c}.enchant-preview b{font-size:14px}
.enchant-chances{display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:8px;background:#0c130dc4;border:1px solid #766746;border-radius:4px}.enchant-cost,.enchant-validation,.enchant-result{margin:8px 0}.enchant-risk{display:flex;gap:7px;align-items:flex-start;color:#f1c68b;font-size:12px;margin:8px 0}.enchant-risk input{margin:3px 0;accent-color:#b69b53}
.equipment-enchant [data-enchant-confirm]{display:block;width:100%;padding:7px;border:1px solid #a79462;background:linear-gradient(#67593c,#3b3322);color:#eee1b8;border-radius:4px;box-shadow:inset 0 0 0 1px #16180f}.equipment-enchant [data-enchant-confirm]:disabled{opacity:.45}.enchant-result{color:#ead295}.enchant-reference{font-size:10px;color:#bdb393;border-top:1px solid #82724f66;padding-top:7px;margin-bottom:0}
.enchant-probability-note{font-size:10px;line-height:1.3;color:#d5ba80;margin:4px 0}
body.touch-client #panel[data-native-panel="enchant"]{width:min(410px,calc(100vw - 34px));margin-top:24px;max-height:calc(100dvh - 40px)}body.touch-client #panel[data-native-panel="enchant"] #panel-body{max-height:calc(100dvh - 100px)}body.touch-client .equipment-enchant{font-size:12px;padding-top:2px}body.touch-client .enchant-preview{margin:6px 0}body.touch-client .enchant-selection{gap:5px}
body.touch-client .enchant-selection{grid-template-columns:1fr 1fr;gap:8px}body.touch-client .enchant-selection label{display:grid;gap:2px;font-size:11px}body.touch-client .enchant-selection select{width:100%;font-size:11px;padding:4px}body.touch-client .enchant-preview{margin:4px 0;padding:2px}body.touch-client .enchant-preview .native-item-icon{width:32px;height:30px;flex:0 0 32px}body.touch-client .enchant-preview b{font-size:12px}body.touch-client .enchant-chances{padding:5px;gap:2px;font-size:11px}body.touch-client .enchant-cost{margin:4px 0;font-size:11px}body.touch-client .enchant-risk{font-size:11px;line-height:1.35;margin:4px 0}body.touch-client .equipment-enchant [data-enchant-confirm]{padding:4px;font-size:12px}body.touch-client .enchant-result{font-size:11px;margin:4px 0}body.touch-client .enchant-reference{font-size:9px;line-height:1.3;margin:5px 0 0;padding-top:5px}
body.touch-client #panel[data-native-panel="enchant"] .dialog-head{padding-bottom:4px;margin-bottom:4px}body.touch-client #panel[data-native-panel="enchant"] #panel-eyebrow{display:none}body.touch-client .enchant-probability-note{font-size:9px}

.enchant-preview{position:relative;isolation:isolate}.enchant-effect{position:absolute;width:176px;height:76px;left:50%;top:50%;transform:translate(-50%,-50%);pointer-events:none;z-index:1}

.equipment-enchant [data-celestial-upgrade-confirm]{display:block;width:100%;padding:7px;border:1px solid #a79462;background:linear-gradient(#67593c,#3b3322);color:#eee1b8;border-radius:4px;box-shadow:inset 0 0 0 1px #16180f}
.equipment-enchant [data-celestial-upgrade-confirm]:disabled{opacity:.45}
.equipment-enchant ul{padding-left:20px;margin:7px 0}
body.touch-client .equipment-enchant [data-celestial-upgrade-confirm]{padding:4px;font-size:12px}
/* 2026-10-12 (使用者：關閉按鈕可以在框內嗎): the 強化／鑑定 panel's close button sits inside the frame. */
#panel[data-native-panel="enchant"] #close-panel{top:8px!important;right:8px!important;left:auto!important;width:34px!important;height:34px!important;min-height:34px!important;transform:none!important}
/* 鑑定: the left column keeps room for its note instead of one character per line. */
.enchant-pro.identify-panel{grid-template-columns:minmax(150px,200px) minmax(0,1fr)!important}
/* Solid board: the bag window behind no longer shows through; 鑑定 gets a wider board. */
#panel[data-native-panel="enchant"]{background:#1c160e url('/assets/ui/native-detail-wood.png') repeat!important;opacity:1!important}
#panel[data-native-panel="enchant"]:has(.identify-panel){width:min(560px,calc(100vw - 34px))!important}
.enchant-pro.identify-panel .ep-empty{font-size:12px;line-height:1.5}

/* 2026-11-06（使用者截圖：手機橫式強化視窗太小）：橫式觸控改成上下貼齊畫面（不靠 dvh 換算，遊戲內有時被壓到一半高），加寬，裝備欄一排 6 格，內容在視窗內捲動。 */
html:not([data-portrait="true"]) body.touch-client #panel[open][data-native-panel="enchant"]{position:fixed!important;top:12px!important;bottom:12px!important;left:0!important;right:0!important;margin:0 auto!important;height:auto!important;max-height:none!important;width:min(640px,calc(100vw - 36px))!important;max-width:none!important;transform:none!important;display:flex!important;flex-direction:column;box-sizing:border-box}
html:not([data-portrait="true"]) body.touch-client #panel[data-native-panel="enchant"] #panel-body{flex:1 1 auto;min-height:0;max-height:none!important;height:auto!important;overflow:auto!important}
html:not([data-portrait="true"]) body.touch-client #panel[data-native-panel="enchant"] .enchant-pro{grid-template-columns:minmax(0,300px) minmax(0,1fr)!important;gap:14px}
html:not([data-portrait="true"]) body.touch-client #panel[data-native-panel="enchant"] .enchant-pro .ep-left .ep-grid{grid-template-columns:repeat(6,44px)!important;gap:5px}
html:not([data-portrait="true"]) body.touch-client #panel[data-native-panel="enchant"] .enchant-pro .ep-right .ep-grid{grid-template-columns:repeat(auto-fill,44px)!important;gap:5px}
html:not([data-portrait="true"]) body.touch-client #panel[data-native-panel="enchant"] .enchant-pro button.ep-slot{width:44px!important;height:44px!important}

/* 2026-11-06（使用者截圖：鑑定視窗太大而且沒有X可以按，全系統窗口不要一下大一下小）：強化、鑑定、天上升級共用 enchant 標記，上面的放大規則誤套到鑑定。三個視窗改成和其他視窗相同的 640px 寬（touch.css #panel 標準）；鑑定恢復自己的欄寬、空清單文字跨整列；手機橫式所有視窗開著時疊在右側按鈕（守護 28、簽到 30）之上，X 不會被蓋住。 */
html:not([data-portrait="true"]) body.touch-client #panel[data-native-panel="enchant"] .enchant-pro.identify-panel{grid-template-columns:minmax(150px,220px) minmax(0,1fr)!important}
html:not([data-portrait="true"]) body.touch-client #panel[data-native-panel="enchant"] .enchant-pro .ep-grid>.ep-empty{grid-column:1/-1}
html:not([data-portrait="true"]) body.touch-client #panel[open]{z-index:31!important}
/* 2026-11-06 實測修正：上面的放大規則原本沒限定 [open]，display:flex!important 讓關掉的視窗仍顯示（按 X 像沒反應、又被附近任務蓋住）；改成只套開著的。鑑定左欄寬 220，裝備格改自動排列，不再撐出 6 格把說明擠到右欄。 */
html:not([data-portrait="true"]) body.touch-client #panel[data-native-panel="enchant"] .enchant-pro.identify-panel .ep-left .ep-grid{grid-template-columns:repeat(auto-fill,44px)!important}
