/* Native sysmenu.dat artwork, displayed at 150% on desktop. */
body #npc-shop{position:fixed;z-index:30;inset:24px max(16px,12vw) auto auto;margin:0;padding:0;max-width:none;max-height:none;overflow:visible;background:transparent;border:0;border-image:none;border-radius:0;box-shadow:none;color:#e5d493;font:12px Tahoma,sans-serif}
body #npc-shop::backdrop{background:transparent;backdrop-filter:none}
#npc-shop .shop-surface{position:relative;width:246px;height:321px;transform:scale(var(--shop-scale,1.5));transform-origin:top left;background:url('trade-textless.png') 0 0/100% 100%}
#npc-shop .shop-menu{width:211px;height:294px}
#npc-shop .shop-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
body #npc-shop button{padding:0;margin:0;border:0;border-radius:0;box-shadow:none;background:transparent;color:inherit;cursor:pointer;transition:none}
body #npc-shop button:hover{box-shadow:inset 0 0 0 1px #fff3b9;backdrop-filter:brightness(1.12)}
body #npc-shop button:disabled{opacity:1;cursor:default;box-shadow:none;backdrop-filter:none}
body #npc-shop button:focus-visible{outline:1px solid #ffe5a1;outline-offset:-2px}
#npc-shop .shop-menu button{position:absolute;height:23px}
#npc-shop .menu-buy{left:30px;top:119px;width:70px}
#npc-shop .menu-sell{left:109px;top:119px;width:70px}
#npc-shop .menu-learn{left:30px;top:152px;width:149px}
#npc-shop .menu-item{left:30px;top:183px;width:149px}
#npc-shop .menu-repair{left:30px;top:214px;width:149px}
#npc-shop .menu-exit{left:69px;top:246px;width:72px;height:27px}
#npc-shop .shop-menu-no-repair :is(.menu-buy,.menu-sell){top:134px}
#npc-shop .shop-menu-no-repair .menu-learn{top:167px}
#npc-shop .shop-menu-no-repair .menu-item{top:198px}
#npc-shop .shop-menu-no-repair .menu-repair{display:none}
/* MN_MAGIC_GUILD: original sysmenu record 491, SmallMenuSet.cpp 1722–1756. */
#npc-shop .shop-menu-magic-guild .menu-buy{left:31px;top:138px;width:149px;height:22px}
#npc-shop .shop-menu-magic-guild .menu-learn{left:31px;top:199px;width:149px;height:22px}
#npc-shop .shop-menu-magic-guild .menu-exit{left:69px;top:246px;width:72px;height:27px}
/* MN_SHOP_MAIN: sysmenu 538 and small_etc 1 at (24,45). Keep native STORE/DONE lettering. */
#npc-shop .shop-menu-grocery .grocery-sign{position:absolute;left:24px;top:45px;width:163px;height:47px;background:url('grocery-sign.png')}
body #npc-shop .shop-menu-grocery :is(.menu-buy,.menu-sell){left:52px;width:104px;height:26px;color:#e5d493}
#npc-shop .shop-menu-grocery .menu-buy{top:142px}
#npc-shop .shop-menu-grocery .menu-sell{top:173px}
body #npc-shop .shop-menu-grocery .menu-exit{left:72px;top:249px;width:66px;height:21px;font-size:0}
#npc-shop .shop-menu .menu-magic{left:30px;top:224px;width:149px;height:23px;background:var(--shop-menu-art) -30px -198px/211px 294px}
#npc-shop .shop-menu button:disabled{color:#514a39;opacity:1;text-shadow:0 1px #c9bb92}
#npc-shop .shop-buy-title{position:absolute;left:67px;top:7px;width:101px;height:23px}
#npc-shop .shop-grid{position:absolute;left:25px;top:36px;width:175px;height:105px;display:grid;grid-template-columns:repeat(5,35px);grid-template-rows:repeat(3,35px);gap:0}
body #npc-shop .shop-grid button{display:flex;align-items:center;justify-content:center;min-width:0;position:relative}
body #npc-shop .shop-grid button[aria-pressed=true]{background:#ffdb7620;box-shadow:inset 0 0 0 1px #e5c77a}
#npc-shop .real-icon{display:inline-block;flex:none;background-repeat:no-repeat}
#npc-shop .shop-grid small{position:absolute;right:1px;bottom:0;font-size:8px;color:#fff;text-shadow:1px 1px #000}
#npc-shop .shop-up,#npc-shop .shop-down{position:absolute;left:205px;width:16px;height:31px;background-size:100% 100%}
body #npc-shop .shop-up{top:37px;background-image:url('up.png')}
body #npc-shop .shop-down{top:108px;background-image:url('down.png')}
body #npc-shop :is(.shop-up,.shop-down):disabled{filter:grayscale(1) brightness(.45);cursor:default}
/* Keep the selected item near the left edge and vertically centered in the black inset (y=158..210). */
#npc-shop .shop-preview{position:absolute;left:25px;top:158px;width:189px;height:52px;display:flex;align-items:center;gap:6px;color:#d1b652;font-size:11px;line-height:14px}
#npc-shop[data-mode="sell"] .shop-preview{left:35px;width:179px}
#npc-shop .shop-order{margin:0}
#npc-shop .shop-price,#npc-shop .shop-wallet{position:absolute;display:block;text-align:right;color:#d6d3bb;font:12px Tahoma;line-height:16px;margin:0}
#npc-shop .shop-price{left:90px;top:229px;width:59px}
#npc-shop .shop-wallet{left:75px;top:265px;width:73px}
#npc-shop .shop-confirm,#npc-shop .shop-cancel{position:absolute;top:253px;height:37px;width:37px}
#npc-shop .shop-confirm{left:25px}#npc-shop .shop-cancel{left:183px}
#npc-shop .shop-notice{position:absolute;top:320px;left:0;width:100%;min-height:0;margin:4px 0 0;background:#080a08d9;color:#edcd7d;font-size:10px;text-align:center}
#npc-shop .shop-notice:empty{display:none}
#npc-shop .shop-tooltip{position:absolute;right:calc(100% + 8px);top:120px;width:200px;padding:6px 4px}
#npc-shop .shop-tooltip,body :is(#item-hover,#gm-item-tooltip){background:rgba(0,0,0,.8);border:1px solid #a4a49b;box-shadow:inset 0 0 0 1px #34382d;color:#c9c9bb;font:12px/1.3 Tahoma,sans-serif;text-shadow:1px 1px #000;pointer-events:none;overflow-wrap:anywhere}
:is(#npc-shop,#item-hover,#gm-item-tooltip) .shop-tip-name{color:#87bd00;margin-bottom:3px}
:is(#npc-shop,#item-hover,#gm-item-tooltip) .shop-tip-row{margin:2px 0}
:is(#npc-shop,#item-hover,#gm-item-tooltip) .shop-tip-label{color:#c8ad38}
:is(#npc-shop,#item-hover,#gm-item-tooltip) .shop-tip-value{color:#c9c9bb}
:is(#npc-shop,#item-hover,#gm-item-tooltip) .shop-tip-unmet{color:#ec3434}
:is(#npc-shop,#item-hover,#gm-item-tooltip) .shop-tip-requirements{padding-left:6px;word-spacing:2px}
#npc-shop .shop-tooltip.inside{right:16px;top:148px;width:196px;z-index:2}
#npc-shop .shop-tooltip[hidden]{display:none}
#npc-shop .shop-learn{padding:14px;box-sizing:border-box;background:url('../ui/stone.png');border:4px ridge #aa9775;color:#211a0f}
#npc-shop .shop-learn h2{font:18px Georgia;text-align:center}
#npc-shop .shop-spells{height:225px;overflow:auto}
body #npc-shop .shop-spells button{display:block;width:100%;text-align:left;padding:5px;border:1px solid #766348;background:#29271fd9;color:#ddc889;font-size:10px}
#npc-shop .shop-spells small{display:block}
@media(max-width:600px){body #npc-shop{right:8px;top:12px}}

body :is(#item-hover,#gm-item-tooltip){display:block;width:312px;max-width:calc(100vw - 16px);padding:9px 6px;border-radius:0;gap:0;font-size:18px;line-height:1.3}
body :is(#item-hover,#gm-item-tooltip)[hidden]{display:none}
/* ExplainItemName uses TxtBgBlueGreen/Red/Blue.dat for ordinary/high/legend. */
body :is(#item-hover,#gm-item-tooltip,#shortcut-tooltip,#npc-shop .shop-tooltip,.bank-tip):has(.rare-tooltip[data-rare-kind="0"]){--rare-frame:url('rare-tooltip-ordinary.png')}
body :is(#item-hover,#gm-item-tooltip,#shortcut-tooltip,#npc-shop .shop-tooltip,.bank-tip):has(.rare-tooltip[data-rare-kind="1"]){--rare-frame:url('rare-tooltip-high.png')}
body :is(#item-hover,#gm-item-tooltip,#shortcut-tooltip,#npc-shop .shop-tooltip,.bank-tip):has(.rare-tooltip[data-rare-kind="2"]){--rare-frame:url('rare-tooltip-legend.png')}
body :is(#item-hover,#gm-item-tooltip,#shortcut-tooltip,#npc-shop .shop-tooltip,.bank-tip):has(.rare-tooltip:is([data-rare-kind="0"],[data-rare-kind="1"],[data-rare-kind="2"])){background:transparent;border-color:transparent;box-shadow:none;isolation:isolate}
body :is(#item-hover,#gm-item-tooltip,#shortcut-tooltip,#npc-shop .shop-tooltip,.bank-tip):has(.rare-tooltip:is([data-rare-kind="0"],[data-rare-kind="1"],[data-rare-kind="2"]))::before{content:'';position:absolute;inset:0;z-index:-1;pointer-events:none;border:solid transparent;border-width:5px 4px;border-image:var(--rare-frame) 5 4 fill / 5px 4px / 0 stretch;opacity:.72}
#npc-shop .shop-sign-title{position:absolute;left:29px;top:56px;width:154px;height:29px;margin:0;display:flex;align-items:center;justify-content:center;text-align:center;font:13px/14px Tahoma,sans-serif;color:#17170f;overflow-wrap:anywhere}
body #npc-shop .shop-menu button{font:12px/1 Tahoma,sans-serif;color:#17170f}
#npc-shop .shop-live-title{position:absolute;left:80px;top:7px;width:79px;text-align:center;font:16px/23px Tahoma,sans-serif;color:#17170f}
#npc-shop :is(.shop-price-label,.shop-currency,.shop-wallet-currency){position:absolute;top:230px;font:10px/16px Tahoma,sans-serif;color:#17170f}
#npc-shop .shop-price-label{left:29px;width:55px;text-align:right}
#npc-shop .shop-currency,#npc-shop .shop-wallet-currency{left:155px;width:28px}
#npc-shop .shop-wallet-currency{top:265px}
body #npc-shop :is(.shop-confirm,.shop-cancel){font:9px/12px Tahoma,sans-serif;color:#17170f;overflow-wrap:anywhere}

/* Trade layout uses only the original artwork bounds. */
#npc-shop .shop-buy{height:321px;background-size:246px 321px;background-repeat:no-repeat}
body #npc-shop .shop-confirm:disabled{color:#555;filter:grayscale(1);cursor:not-allowed}
#npc-shop .shop-catalog-only .real-icon{filter:grayscale(.85);opacity:.55}
#npc-shop .shop-grid .shop-catalog-only small{background:#15150ed9;color:#ffe3a0;font-size:8px;padding:1px;line-height:10px}
#npc-shop .shop-availability{position:absolute;left:25px;top:215px;width:203px;height:23px;display:flex;align-items:center;justify-content:space-between;color:#4a2110;font-size:10px}
body #npc-shop .shop-availability button{margin-left:auto;box-sizing:border-box;width:45px;height:23px;border:1px solid #b69b60;border-radius:3px;background:#322719;color:#fff1c4;font:bold 10px/1 Tahoma,sans-serif;white-space:nowrap}
#npc-shop .shop-buy .shop-notice{top:320px;font-size:11px}
body #npc-shop[data-sources=true]{background:#151b16;border:1px solid #aa9775;box-sizing:border-box;overflow:hidden;color:#f5e7c3}
#npc-shop .shop-sources{height:100%;display:flex;flex-direction:column;font:14px/1.5 Tahoma,sans-serif}
#npc-shop .shop-sources header{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:10px 12px;border-bottom:1px solid #8d815e}
#npc-shop .shop-sources h2{font:17px/1.4 Tahoma,sans-serif;margin:0;color:#ffe3a0}
#npc-shop .shop-source-scroll{overflow:auto;min-height:0;padding:12px;overflow-wrap:anywhere}
#npc-shop .shop-sources :is(h3,p){margin:0 0 8px}
#npc-shop .shop-sources h3{font-size:15px;color:#ffe3a0}
#npc-shop .shop-sources article{padding:12px 0;border-top:1px solid #5c634c;margin-top:12px}
#npc-shop .shop-sources ul{padding-left:20px;margin:8px 0}
#npc-shop .shop-sources summary{cursor:pointer;text-decoration:underline;padding:6px 0}
body #npc-shop .shop-sources button{padding:7px 10px;border:1px solid #8d815e;background:#2a3426;color:#fff0bf;font:inherit;text-align:left;min-height:36px;border-radius:3px}
#npc-shop .shop-sources .shop-source-materials{list-style:none;padding:0;display:grid;gap:10px}
#npc-shop .shop-source-materials li{display:grid;gap:4px}
#npc-shop .shop-source-stats{background:#090d0a;padding:10px;border:1px solid #4b543f}
#npc-shop .shop-source-status{color:#ffe3a0}
#npc-shop .shop-source-stats .shop-tip-unmet{color:#ff9b8a}
