.item-detail-popover{position:fixed;z-index:1200;width:min(410px,calc(100vw - 16px));max-height:calc(100dvh - 16px);overflow:auto;overscroll-behavior:contain;border:1px solid #8a735149;border-radius:18px;background:#101a1b;box-shadow:0 24px 70px #000b,0 0 0 1px #0009;color:#e9e8de;font-family:inherit;outline:none;scrollbar-width:thin;isolation:isolate}
.item-detail-close{position:absolute;right:10px;top:8px;z-index:2;border:0;background:#ffffff0b;color:#bfc8c5;border-radius:50%;width:32px;height:32px;padding:0;font:24px/1 sans-serif;cursor:pointer}
.item-detail-close:focus-visible,[data-item-inspect]:focus-visible{outline:2px solid #e9c686;outline-offset:3px}
.item-detail-card{text-align:left;background:radial-gradient(ellipse at 20% 0%,color-mix(in srgb,var(--detail-grade) 10%,transparent),transparent 50%),linear-gradient(160deg,#1c2827,#10191c);padding:23px 22px 14px;box-sizing:border-box;border-top:2px solid var(--detail-grade);border-radius:17px;overflow:hidden}
.item-detail-kicker{display:flex;justify-content:space-between;padding-right:30px;gap:8px;color:#9baaa4;font-size:11px;letter-spacing:.07em}
.item-detail-kicker span:last-child{color:var(--detail-grade)}
.item-detail-hero>div:last-child{min-width:0}
.item-detail-description{margin:0 0 18px;overflow-wrap:anywhere}.item-detail-description h3{font-size:12px;color:#9caea7;margin:0 0 6px}.item-detail-description p{font-size:12px;line-height:1.8;margin:0;color:#d9e0d6}
.item-detail-facts{font-size:12px;line-height:1.7;margin:18px 0;overflow-wrap:anywhere}.item-detail-facts>div{display:grid;grid-template-columns:minmax(85px,1fr) minmax(0,2fr);gap:12px;padding:7px 0;border-bottom:1px solid #ffffff0a}.item-detail-facts dt{color:#91a69b}.item-detail-facts dd{margin:0;color:#d9e0d6}
.item-detail-card .bag-craft-uses{font-size:12px;line-height:1.8}.item-detail-card .item-art-preview{display:block;font-size:12px;margin-top:14px;color:#cbdab5}
.item-detail-popover{display:grid;grid-template-columns:minmax(0,1fr)}.item-detail-card{grid-area:1/1;min-width:0}.item-detail-close{grid-area:1/1;justify-self:end;align-self:start;position:sticky;top:8px;right:10px;margin:8px 10px 0 0;width:44px;height:44px;z-index:3}.item-detail-kicker{padding-right:42px}
.item-detail-hero{display:flex;align-items:center;gap:17px;padding:22px 0!important;border:0!important;background:none!important}
.item-detail-art{width:82px;height:90px;flex:none;display:grid;place-items:center;border-radius:15px;background:radial-gradient(ellipse,color-mix(in srgb,var(--detail-grade) 12%,transparent),#091313 80%);border:1px solid color-mix(in srgb,var(--detail-grade) 30%,transparent);box-shadow:inset 0 0 22px #0005,0 0 25px color-mix(in srgb,var(--detail-grade) 8%,transparent)}
.item-detail-art img,.item-detail-art .item-image{width:64px!important;height:72px!important;object-fit:contain;image-rendering:pixelated;border:0!important;background:none!important}
.item-detail-hero h2{margin:6px 0 8px!important;color:#f4eddb!important;font-size:21px!important;line-height:1.4;overflow-wrap:anywhere;font-weight:700}
.item-detail-hero h2 em{font-style:normal;color:var(--detail-grade)}
.item-detail-hero small{font-size:11px;color:#9caea7}.item-detail-grade{color:var(--detail-grade);font-size:12px}
.item-base-stats{padding:13px 14px;border:1px solid #ffffff09;border-radius:9px;background:#050d0d55;margin-bottom:22px}
.item-base-stats small{color:#859b94;font-size:10px}.item-base-stats p{margin:5px 0 0;font-size:12px;line-height:1.8;color:#d9e0d6}
.affix-section-title{display:flex;justify-content:space-between;align-items:center;color:#d4d6c8;font-size:13px;margin:0 0 10px}.affix-section-title small{color:#7d928b;font-size:11px}
.affix-row{position:relative;isolation:isolate;overflow:hidden;display:flex;align-items:center;gap:11px;padding:12px 10px;margin:7px 0;border:1px solid color-mix(in srgb,var(--affix-color,#86968c) 22%,transparent);border-left:2px solid color-mix(in srgb,var(--affix-color,#86968c) 70%,transparent);border-radius:8px;background:linear-gradient(95deg,color-mix(in srgb,var(--affix-color,#86968c) 8%,#101a1b),#10191c)}
.affix-grade{display:grid;place-items:center;width:28px;height:30px;flex:none;font:700 20px Georgia,serif;color:var(--affix-color);text-shadow:0 0 12px color-mix(in srgb,var(--affix-color) 35%,transparent)}
.affix-copy{flex:1;min-width:0;z-index:1}.affix-copy>span{font-size:12px;color:#dbe4dc}.affix-copy small{display:block;font-size:9px;color:#879a92;margin-top:3px}.affix-row>strong{color:var(--affix-color);font:700 17px/1.4 system-ui;white-space:nowrap;z-index:1}
.affix-roll-track{width:100%;height:2px;margin-top:7px;background:#ffffff12;border-radius:2px;overflow:hidden}.affix-roll-track i{display:block;height:100%;background:var(--affix-color);opacity:.7}
.affix-mist{position:absolute;inset:0;z-index:-1;pointer-events:none;opacity:.22;background:radial-gradient(ellipse at 15% 100%,var(--affix-color),transparent 55%);transform-origin:left bottom}
.item-detail-card .affix-grade-A .affix-mist,.item-detail-card .affix-grade-S .affix-mist{animation:none;background:radial-gradient(ellipse at 15% 95%,var(--affix-color),transparent 53%),radial-gradient(ellipse at 75% 120%,var(--affix-color),transparent 50%)}
.affix-grade-S{box-shadow:inset 0 0 18px #ffd27c09,0 0 12px #ffd27c09}.affix-grade-S .affix-grade{text-shadow:0 0 16px #ffd27caa}.affix-grade-S .affix-mist{opacity:.3;animation-duration:3.8s}
.affix-empty{color:#60776e;border-style:dashed;font-size:11px;min-height:35px}.affix-footnote{color:#768c82;font-size:9px;line-height:1.7;margin:12px 0 0}.item-crafter{display:grid;gap:5px;font-size:10px;color:#8c9e92;margin-top:18px;padding-top:12px;border-top:1px solid #ffffff0b;overflow-wrap:anywhere}.item-crafter b{color:#cfbf9a;font-weight:500}.item-detail-footer{background:none!important;border:0!important;padding:12px 0 0!important;font-size:9px;color:#657e73;line-height:1.7}
.item-inspect-button{border:1px solid #b2c4aa33;border-radius:7px;padding:7px 11px;background:#1e3028;color:#d1dfc6;font:inherit;font-size:12px;cursor:pointer}.affix-workshop{padding:16px;border:1px solid #9cbe9d22;border-radius:12px;background:#101e19}.affix-workshop h3{margin:0 0 8px}.affix-workshop label{display:grid;gap:7px}.affix-workshop select{width:100%;min-height:40px}.affix-workshop-preview{max-width:410px;margin:18px auto}.affix-workshop .affix-rate{display:inline-flex;gap:7px;margin:4px;padding:5px 9px;border:1px solid #ffffff13;border-radius:6px}.affix-workshop .affix-rates{margin:12px 0}.affix-workshop .affix-warning{color:#eac08c;line-height:1.7}.affix-workshop [role=status]{min-height:24px;line-height:1.6;color:#c7d6be}.affix-workshop button{min-height:42px}
@keyframes affix-smoke{0%{transform:translateX(-7%) scale(1);opacity:.12}100%{transform:translateX(8%) scale(1.17);opacity:.32}}
@media(prefers-reduced-motion:reduce){.affix-row .affix-mist{animation:none!important;transform:none!important;opacity:.18}}
@media(max-width:480px){.item-detail-card{padding:20px 15px 13px}.item-detail-hero h2{font-size:18px!important}.item-detail-art{width:68px;height:78px}.affix-row{gap:8px;padding:11px 8px}.affix-copy>span{font-size:11px}.affix-row>strong{font-size:15px}}

/* One inventory grid; item content and native actions belong to its popup. */
#game-shell .bag-layout{grid-template-columns:minmax(0,1fr)!important}
.bag-action-source[hidden]{display:none!important}
.item-detail-popover{display:flex;flex-direction:column;width:min(780px,calc(100vw - 16px));max-height:min(560px,calc(100dvh - 16px));overflow:hidden;box-sizing:border-box}
.item-detail-scroll{order:1;min-height:0;overflow:auto;overflow-anchor:none;overscroll-behavior:contain;scrollbar-width:thin}
.item-detail-popover .item-detail-card{display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr);gap:0 22px;border-radius:16px;min-width:0}
.item-detail-popover .item-detail-kicker{grid-column:1/-1}
.item-detail-summary,.item-detail-information{min-width:0}
.item-detail-popover .item-detail-hero{align-items:flex-start;gap:12px}
.item-detail-popover .item-detail-hero h2{font-size:19px!important}
.item-detail-information{padding-top:20px}
.item-detail-description summary{font-size:13px;color:#d9e0d6;cursor:pointer;min-height:44px;display:flex;align-items:center;gap:8px}
.item-detail-description summary:before{content:'▸';color:#cdbb85}.item-detail-description[open]>summary:before{content:'▾'}
.item-detail-description summary:focus-visible{outline:2px solid #e9c686;outline-offset:2px}
.item-detail-description p{margin-top:4px}
.item-detail-summary{display:flex;flex-direction:column;align-self:start}
.item-detail-summary>.item-detail-hero{order:0}
.item-detail-summary>.item-base-stats{order:2}
.item-detail-actions{order:1;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) 56px 62px;gap:4px;padding:0;margin:0 0 18px;border:0;background:none;flex:none}
.item-detail-actions[hidden]{display:none}
.item-detail-actions button,.item-detail-actions .dye-control{font:inherit;font-size:11px;min-width:0;min-height:44px;padding:7px 4px;border:1px solid #7f9868;border-radius:7px;background:#32472d;color:#f0e6c5;cursor:pointer}
.item-detail-actions>[data-equip],.item-detail-actions>[data-use-item],.item-detail-actions>[data-use-rod]{grid-column:1;grid-row:1}
.item-detail-actions>[data-item-lock]{grid-column:2;grid-row:1}
.item-detail-actions>[data-drop-type]{grid-column:3;grid-row:1;font-size:10.5px}
.item-detail-actions>[data-drop-item]{grid-column:4;grid-row:1}
.item-detail-actions>.dye-control,.item-detail-actions>[data-quick-medicine]{grid-column:1/-1}
.item-detail-actions:not(:has(>[data-equip],>[data-use-item],>[data-use-rod])){grid-template-columns:minmax(0,1fr) 56px 62px}
.item-detail-actions:not(:has(>[data-equip],>[data-use-item],>[data-use-rod]))>[data-item-lock]{grid-column:1}
.item-detail-actions:not(:has(>[data-equip],>[data-use-item],>[data-use-rod]))>[data-drop-type]{grid-column:2}
.item-detail-actions:not(:has(>[data-equip],>[data-use-item],>[data-use-rod]))>[data-drop-item]{grid-column:3}
.item-detail-actions>button:only-child{grid-column:1/-1}
.item-detail-actions button:disabled{opacity:.5;cursor:default}
.item-detail-actions [data-drop-item],.item-detail-actions [data-drop-type]{border-color:#b58269;background:#583d31}
.item-detail-actions .dye-control{display:flex;align-items:center;gap:8px}.item-detail-actions input[type=color]{width:42px;height:28px;padding:0;border:0}
.item-detail-close{position:absolute;grid-area:auto;top:8px;right:10px;margin:0;z-index:4}
@media(orientation:portrait){
 .item-detail-popover{width:min(480px,calc(100vw - 16px));max-height:calc(100dvh - 16px)}
 .item-detail-popover .item-detail-card{display:block}
 .item-detail-summary>.item-base-stats{order:1}
 .item-detail-actions{order:2;padding:0;border:0;margin:0 0 14px}
 .item-detail-information{padding-top:0}
}

/* Inventory tools share the popup's quiet green and gold hierarchy. */
#game-shell #drawer:has(.bag-layout) .bag-board-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
#game-shell #drawer:has(.bag-layout) .bag-board-heading h3{border:0;margin:0;padding:0;justify-content:flex-start;align-items:center}
#game-shell #drawer #drawer-content .bag-board-heading p{margin:5px 0 0;color:#9db5aa;font-size:11px;line-height:1.6}
#game-shell #drawer:has(.bag-layout) #bag-consolidate{width:auto;flex:none;min-height:40px;margin:0;padding:8px 16px;border:1px solid #a99058;border-radius:9px;background:linear-gradient(145deg,#4c4c2f,#303a28);color:#f0dfae;font-size:12px}
#game-shell .bag-tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px;background:#0b1d1780;border:1px solid #a6c6b21a;border-radius:10px}
#game-shell .bag-search{flex:1 1 180px;min-width:0;position:relative}
#game-shell .bag-search>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
#game-shell .bag-search input{box-sizing:border-box;width:100%;min-height:40px;margin:0;padding:8px 12px;border:1px solid #587565;border-radius:7px;background:#10261e;color:#e9e8de;font:inherit;font-size:12px}
#game-shell .bag-categories{display:flex;flex-wrap:wrap;gap:4px}
#game-shell #drawer #drawer-content .bag-categories button{width:auto;min-height:44px;margin:0;padding:7px 11px;border:1px solid transparent;border-radius:7px;background:transparent;color:#abc1b4;font:inherit;font-size:12px;line-height:1.3;white-space:nowrap}
#game-shell #drawer #drawer-content .bag-categories button[aria-pressed=true]{border-color:#a7bc8466;background:#3c5134;color:#f0dfae}
#game-shell #drawer #drawer-content .bag-stack-help{color:#95ab9e;font-size:11px;line-height:1.6;margin:9px 2px}
#game-shell #drawer:has(.bag-layout) #drawer-content .bag-slots{height:auto;min-height:116px;max-height:min(40dvh,360px);grid-template-columns:repeat(auto-fill,56px);gap:8px;padding:5px;scrollbar-gutter:stable}
#game-shell #drawer:has(.bag-layout) #drawer-content .bag-slot{width:56px;height:56px;min-height:56px;border-radius:10px}
#game-shell #drawer:has(.bag-layout) .bag-slot[hidden],#game-shell .bag-filter-empty[hidden]{display:none!important}
#game-shell #drawer:has(.bag-layout) .bag-slot[data-popup-open=true]{outline:2px solid #e9ce89;outline-offset:2px;box-shadow:0 0 0 5px #e9ce8915,inset 0 0 14px #d8bc6e25}
#game-shell .bag-filter-empty{padding:16px;text-align:center;color:#aec3b4;font-size:12px}
.item-detail-context{order:-1;font-size:10px;line-height:1.7;color:#b6cba9;padding:7px 10px;margin:12px 0 0;border:1px solid #b6cba924;border-radius:7px;background:#07151066;overflow-wrap:anywhere}
.item-detail-context[hidden]{display:none}
@media(orientation:landscape) and (min-height:600px){.item-detail-summary{position:sticky;top:10px}.item-detail-information{border-left:1px solid #c3d5c41a;padding-left:20px}}
@media(max-width:480px){
 #game-shell .bag-tools{gap:6px;padding:7px}
 #game-shell .bag-categories{width:100%;display:grid;grid-template-columns:repeat(5,minmax(0,1fr))}
 #game-shell #drawer #drawer-content .bag-categories button{padding:6px 1px;font-size:10px;min-width:0}
 #game-shell #drawer:has(.bag-layout) #drawer-content .bag-slots{grid-template-columns:repeat(auto-fill,48px);gap:6px;min-height:100px;max-height:30dvh}
 #game-shell #drawer:has(.bag-layout) #drawer-content .bag-slot{width:48px;height:48px;min-height:48px}
 #game-shell #drawer #drawer-content .bag-board-heading p{font-size:10px}
}

@media(orientation:portrait) and (max-width:600px){
 #game-shell #drawer:has(.bag-layout) #drawer-content>h2{font-size:24px;margin:5px 0 12px}
 #game-shell #drawer:has(.bag-layout) #drawer-content .bag-summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 #game-shell #drawer:has(.bag-layout) #drawer-content .bag-summary>span{padding:8px;gap:4px}
 #game-shell #drawer:has(.bag-layout) .bag-board-heading{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;margin-bottom:10px}
 #game-shell #drawer:has(.bag-layout) #bag-consolidate{min-height:44px;padding:8px 12px}
 #game-shell #drawer #drawer-content .bag-categories button{font-size:12px;padding:6px 1px}
 #game-shell #drawer #drawer-content .bag-search input{min-height:44px;font-size:16px}
 .item-detail-popover .item-detail-hero{align-items:center;padding:14px 0!important}
 .item-detail-popover .item-detail-art{width:64px;height:74px}
 .item-detail-popover .item-detail-art .item-image{width:54px!important;height:64px!important}
 .item-detail-popover .item-detail-hero h2{font-size:18px!important;line-height:1.35}
 .item-detail-popover .item-base-stats{padding:10px 12px;margin-bottom:12px}
 .item-detail-popover .item-detail-context{font-size:11px;margin-top:8px}
}
