/* A single decision stage, followed immediately by the two item libraries. */
body.upgrade-page .upgrade-main { gap: 24px; }
body.upgrade-page .upgrade-hero { display: block; padding: 0; }
body.upgrade-page .upgrade-hero h1 { font-size: 34px !important; line-height: 1.15; margin: 0; }
body.upgrade-page .upgrade-subtitle { max-width: none; font-size: 14px; color: #a6a59b; }
body.upgrade-page .upgrade-hero__stats { display: none; }
body.upgrade-page .upgrade-workbench { grid-template-columns: 1fr 1fr; grid-template-areas: 'scene scene' 'inventory market'; gap: 20px; }
body.upgrade-page .upgrade-scene { grid-area: scene; display: grid; grid-template-columns: minmax(0,1fr) 290px minmax(0,1fr); gap: 28px; padding: 24px; background: radial-gradient(ellipse at 50% 10%,color-mix(in srgb,var(--gb-accent) 4%,transparent),transparent 65%),#191917; border: 1px solid #ffffff10; border-radius: 16px; }
body.upgrade-page .upgrade-scene .upgrade-panel { grid-area: auto; border: 0 !important; border-radius: 0; background: transparent !important; box-shadow: none !important; padding: 0; min-width: 0; }
body.upgrade-page .upgrade-scene .panel-head { min-height: 43px; margin-bottom: 16px; }
body.upgrade-page .upgrade-scene .panel-head h2 { font-size: 17px; }
body.upgrade-page .upgrade-scene .section-kicker { font-size: 10px; letter-spacing: .055em; color: #939389; }
body.upgrade-page .upgrade-panel--engine .panel-head { justify-content: center; min-height: 20px; margin-bottom: 0; }
body.upgrade-page .upgrade-panel--engine .live-badge { display: none; }
body.upgrade-page .upgrade-panel--engine .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body.upgrade-page .wheel-card { padding: 0; border: 0 !important; background: transparent !important; box-shadow: none !important; }
body.upgrade-page #luck-circle { width: 156px; height: 156px; }
body.upgrade-page .selected-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
body.upgrade-page .selected-slot { min-height: 84px; height: 84px; padding: 6px; gap: 2px; border-color: #ffffff14; background: #131311; }
body.upgrade-page .selected-slot__empty { font-size: 24px; font-weight: 400; color: #55554c; }
body.upgrade-page .selected-slot__index { font-size: 9px; font-weight: 500; position: absolute; left: 7px; top: 5px; }
body.upgrade-page .selected-slot__image { width: 90%; height: 43px; object-fit: contain; }
body.upgrade-page .selected-slot__name { display: none; }
body.upgrade-page .selected-slot__price { font-size: 10px; }
body.upgrade-page .selected-slot__remove { position: absolute !important; display: grid; place-items: center; width: 23px; height: 23px; min-height: 0; padding: 0; right: 3px; top: 3px; font-size: 16px; line-height: 1; z-index: 2; }
body.upgrade-page .selection-link { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding: 10px 0; color: #c2c1b7; font-size: 12px; text-decoration: none; }
body.upgrade-page .selection-link:hover { color: var(--gb-accent); }
body.upgrade-page .summary-chips { border-top: 1px solid #ffffff0c; padding-top: 12px; margin-top: 0; display: flex; flex-wrap: wrap; gap: 8px; }
body.upgrade-page .summary-chip { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0; flex: 1 1 auto; }
body.upgrade-page .summary-chip__label { display: block; font-size: 10px; color: #8d8e81; }
body.upgrade-page .summary-chip .summary-chip__value { display: block; font-size: 12px; font-weight: 600; color: #e1e2d6; margin-top: 3px; }
body.upgrade-page .modes { grid-template-columns: repeat(6,minmax(0,1fr)); gap: 4px; }
body.upgrade-page .modes button { min-height: 34px; padding: 4px 0; font-size: 11px; border-radius: 7px; }
body.upgrade-page #upgrade-btn { margin-top: 10px; min-height: 44px; font-size: 13px; }
body.upgrade-page #upgrade-btn { display:flex; align-items:center; justify-content:center; gap:10px; flex-wrap:wrap; }
body.upgrade-page .upgrade-btn__label { font-weight:800; }
body.upgrade-page .upgrade-btn__meta { padding-left:10px; border-left:1px solid currentColor; opacity:.68; font-size:10px; font-weight:700; }
body.upgrade-page .upgrade-panel--engine.is-spinning .wheel-card { animation: upgradeEnginePulse 1s ease-in-out infinite alternate; }
body.upgrade-page .upgrade-panel--engine.is-spinning #upgrade-btn { cursor:wait; }
body.upgrade-page .upgrade-skeleton { min-height:142px; border-radius:12px; border:1px solid #ffffff0b; background:linear-gradient(100deg,#22231e 18%,#303129 36%,#22231e 54%); background-size:220% 100%; animation:upgradeSkeleton 1.2s ease-in-out infinite; }
body.upgrade-page [aria-busy="true"] { cursor:progress; }
@keyframes upgradeSkeleton { to { background-position:-220% 0; } }
@keyframes upgradeEnginePulse { from { filter:drop-shadow(0 0 0 color-mix(in srgb,var(--gb-accent) 0%,transparent)); } to { filter:drop-shadow(0 0 16px color-mix(in srgb,var(--gb-accent) 35%,transparent)); } }
body.upgrade-page .upgrade-status { margin-top: 6px; padding: 0; font-size: 11px; min-height: 34px; line-height: 1.5; }
body.upgrade-page .target-preview { min-height: 176px; height: 176px; padding: 10px; background: radial-gradient(ellipse,color-mix(in srgb,var(--gb-accent) 6%,transparent),transparent 75%); border: 0; }
body.upgrade-page .target-preview__image { height: 105px; width: 180px; padding: 0; }
body.upgrade-page .target-preview--filled { gap: 2px; }
body.upgrade-page .target-preview__title { font-size: 12px; line-height: 1.4; }
body.upgrade-page .target-preview__tag { display: none; }
body.upgrade-page .target-preview__price { font-size: 15px; }
body.upgrade-page .target-preview .empty-state { padding: 8px; }
body.upgrade-page .empty-state strong { font-size: 14px; }
body.upgrade-page .empty-state span { font-size: 12px; }
body.upgrade-page .upgrade-scene #randomize-target { min-height: 30px; padding: 0 9px; font-size: 10px; }
body.upgrade-page :is(.upgrade-library,.upgrade-market) { padding: 20px; scroll-margin-top: 100px; }
body.upgrade-page :is(.upgrade-library,.upgrade-market) .panel-head { margin-bottom: 16px; }
body.upgrade-page .library-caption { display: block; font-size: 11px; margin-bottom: 5px; color: #8f9084; }
body.upgrade-page .panel-count { background: #2a2c23; color: #c5c6b9; border-radius: 7px; min-width: 30px; padding: 5px 9px; font-size: 12px; }
body.upgrade-page :is(.inventory-grid,.target-grid) { grid-template-columns: repeat(3,minmax(0,1fr)); max-height: 540px; overflow-y: auto; }
body.upgrade-page .filters { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
body.upgrade-page .filters #search-text { grid-column: 1 / 3; }
body.upgrade-page .filters #sort-by { grid-column: 3; }
body.upgrade-page .filters #reset-filters { grid-column: 3; }
body.upgrade-page .filters :is(input,select,button) { min-width: 0; font-size: 11px; padding: 8px; min-height: 34px; }
body.upgrade-page .upgrade-result { margin-top: 10px; padding: 10px; }
body.upgrade-page :is(a,button,input,select):focus-visible { outline: 2px solid var(--gb-accent); outline-offset: 3px; }
.upgrade-mobile-nav { display:none; }
@media(max-width:1100px) {
 body.upgrade-page .upgrade-scene { gap: 16px; padding: 20px; grid-template-columns: minmax(0,1fr) 250px minmax(0,1fr); }
 body.upgrade-page :is(.inventory-grid,.target-grid) { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:900px) {
 body.upgrade-page .upgrade-main { gap: 18px; }
 body.upgrade-page .upgrade-hero h1 { font-size: 28px !important; }
 body.upgrade-page .upgrade-subtitle { font-size: 12px; line-height: 1.6; }
 body.upgrade-page .upgrade-workbench { grid-template-columns: minmax(0,1fr); grid-template-areas: 'scene' 'inventory' 'market'; gap: 14px; }
 body.upgrade-page .upgrade-scene { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px 12px; padding: 14px; }
 body.upgrade-page .upgrade-scene .upgrade-panel--engine { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: 100px minmax(0,1fr); column-gap: 14px; border-top: 1px solid #ffffff0d !important; padding-top: 14px; }
 body.upgrade-page .upgrade-panel--engine .panel-head { display: none; }
 body.upgrade-page .wheel-card { grid-column: 1; grid-row: 1 / 4; align-self: center; }
 body.upgrade-page #luck-circle { width: 100px; height: 100px; }
 body.upgrade-page .modes { grid-column: 2; grid-template-columns: repeat(3,minmax(0,1fr)); }
 body.upgrade-page #upgrade-btn { grid-column: 2; margin-top: 6px; font-size: 11px; min-height: 38px; }
 body.upgrade-page .upgrade-status { grid-column: 1 / -1; min-height: 0; margin-top: 9px; }
 body.upgrade-page .upgrade-result { grid-column: 1 / -1; }
 body.upgrade-page .upgrade-scene .panel-head { min-height: 38px; margin-bottom: 10px; }
 body.upgrade-page .upgrade-scene .panel-head h2 { font-size: 13px; }
 body.upgrade-page .upgrade-scene .section-kicker { font-size: 8px; letter-spacing: 0; }
 body.upgrade-page #randomize-target { display: none; }
 body.upgrade-page .selected-grid { gap: 4px; }
 body.upgrade-page .selected-slot { height: 56px; min-height: 56px; padding: 3px; }
 body.upgrade-page .selected-slot__index { font-size: 7px; left: 3px; top: 2px; }
 body.upgrade-page .selected-slot__image { height: 29px; }
 body.upgrade-page .selected-slot__price { font-size: 8px; }
 body.upgrade-page .selected-slot__remove { width: 19px; height: 19px; right: 0; top: 0; }
 body.upgrade-page .target-preview { height: 116px; min-height: 116px; padding: 0; }
 body.upgrade-page .target-preview__image { height: 65px; max-width: 100%; }
 body.upgrade-page .target-preview__title { font-size: 9px; }
 body.upgrade-page .target-preview__price { font-size: 12px; }
 body.upgrade-page .target-preview .empty-state strong { font-size: 12px; }
 body.upgrade-page .target-preview .empty-state span { font-size: 10px; line-height: 1.4; }
 body.upgrade-page .selection-link { font-size: 10px; margin-top: 5px; padding: 6px 0; }
 body.upgrade-page .summary-chips { padding-top: 6px; }
 body.upgrade-page .upgrade-panel--selected .summary-chips,
 body.upgrade-page .upgrade-panel--target .summary-chips { display: flex; }
 body.upgrade-page .summary-chip .summary-chip__value { font-size: 10px; }
 body.upgrade-page .summary-chip__label { font-size: 9px; }
 body.upgrade-page :is(.upgrade-library,.upgrade-market) { padding: 14px; }
 body.upgrade-page :is(.inventory-grid,.target-grid) { max-height: 440px; }
}
/* Mobile workspace: readable slots and quick return after choosing a target. */
@media(max-width:900px) {
 body.upgrade-page .upgrade-main { padding-bottom:90px; }
 body.upgrade-page #upgrade-controls { scroll-margin-top:84px; }
 body.upgrade-page .selection-link { min-height:44px; font-size:12px; }
 body.upgrade-page .selected-slot__remove { width:44px; height:44px; right:0; top:0; font-size:20px; background:transparent; }
 body.upgrade-page .upgrade-scene .section-kicker { font-size:10px; }
 body.upgrade-page .target-preview__title { font-size:12px; }
 body.upgrade-page .selected-slot__price { font-size:11px; }
 body.upgrade-page .selected-slot__image { height:42px; }
 body.upgrade-page .selected-slot { min-height:78px; height:78px; }
 body.upgrade-page .upgrade-mobile-nav { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); position:fixed; z-index:80; left:max(10px,env(safe-area-inset-left)); right:max(10px,env(safe-area-inset-right)); bottom:max(8px,env(safe-area-inset-bottom)); padding:6px; gap:5px; border:1px solid #414135; border-radius:14px; background:#20201cf5; box-shadow:0 6px 24px #0008; }
 body.upgrade-page .upgrade-mobile-nav a { display:flex; align-items:center; justify-content:center; min-height:44px; padding:6px; border-radius:9px; color:#d3d3c7; font-size:12px; text-decoration:none; }
 body.upgrade-page .upgrade-mobile-nav a:last-child { background:color-mix(in srgb,var(--gb-accent) 12%,#20201c); color:var(--gb-accent); }
 body.upgrade-page .site-footer { padding-bottom:90px; }
 body.upgrade-page .filters input { min-height:44px; }
}
@media(max-width:480px) {
 body.upgrade-page .page-shell { padding-left:10px; padding-right:10px; }
 body.upgrade-page .upgrade-scene { padding:12px; }
 body.upgrade-page .upgrade-btn__meta { width:100%; padding:0; border:0; font-size:10px; }
 body.upgrade-page #upgrade-btn { gap:2px; padding:8px; }
 body.upgrade-page .upgrade-skeleton { min-height:126px; }
 body.upgrade-page .upgrade-scene { grid-template-columns:minmax(0,1fr); }
 body.upgrade-page .upgrade-panel--target { grid-row:2; }
 body.upgrade-page .upgrade-scene .upgrade-panel--engine { grid-row:3; }
 body.upgrade-page .selected-grid { gap:8px; }
 body.upgrade-page .selected-slot__index { font-size:10px; }
 body.upgrade-page .upgrade-scene .panel-head h2 { font-size:16px; }
 body.upgrade-page .target-preview { min-height:120px; height:auto; }
 body.upgrade-page .target-preview__image { height:75px; }
 body.upgrade-page .summary-chip__label { font-size:11px; }
 body.upgrade-page .summary-chip .summary-chip__value { font-size:12px; }
 body.upgrade-page .upgrade-library, body.upgrade-page .upgrade-market { scroll-margin-top:82px; }
}
@media(prefers-reduced-motion:reduce) {
 body.upgrade-page .upgrade-skeleton,
 body.upgrade-page .upgrade-panel--engine.is-spinning .wheel-card { animation:none; }
}

/* Desktop workbench: all three decisions and both item libraries fit the initial viewport. */
@media(min-width:1101px) and (min-height:720px){
 body.upgrade-page .upgrade-main{gap:12px}body.upgrade-page .page-shell{padding-top:14px;padding-bottom:18px}
 body.upgrade-page .seo-breadcrumbs{margin:0!important}body.upgrade-page .upgrade-hero h1{font-size:28px!important}body.upgrade-page .upgrade-subtitle{font-size:12px;margin:5px 0 0}
 body.upgrade-page .upgrade-workbench{height:calc(100dvh - var(--fixed-header-height,90px) - 125px);min-height:480px;grid-template-rows:320px minmax(210px,1fr);gap:12px}
 body.upgrade-page .upgrade-scene{gap:18px;padding:14px 18px;height:100%;box-sizing:border-box;align-self:stretch;grid-template-columns:minmax(0,1fr) 270px minmax(0,1fr);min-height:0}
 body.upgrade-page .upgrade-scene .panel-head{min-height:25px;margin-bottom:8px}body.upgrade-page .upgrade-scene .panel-head h2{font-size:15px}body.upgrade-page .upgrade-scene .section-kicker{font-size:9px}
 body.upgrade-page .upgrade-panel--engine .panel-head{min-height:15px;margin-bottom:0}body.upgrade-page #luck-circle{width:122px;height:122px}
 body.upgrade-page .selected-grid{gap:6px}body.upgrade-page .selected-slot{height:60px;min-height:60px;padding:4px}body.upgrade-page .selected-slot__image{height:32px}
 body.upgrade-page .target-preview{height:128px;min-height:128px;padding:4px}body.upgrade-page .target-preview__image{height:72px}
 body.upgrade-page .selection-link{margin-top:5px;padding:5px 0;font-size:11px}body.upgrade-page .summary-chips{padding-top:6px}body.upgrade-page .summary-chip__label{font-size:9px}
 body.upgrade-page .modes button{min-height:29px;font-size:10px}body.upgrade-page #upgrade-btn{margin-top:6px;min-height:40px}body.upgrade-page .upgrade-status{min-height:25px;font-size:10px;margin-top:4px}body.upgrade-page .upgrade-result:not(.is-win):not(.is-loss){display:none}
 body.upgrade-page :is(.upgrade-library,.upgrade-market){padding:14px;min-height:0;height:100%;align-self:stretch;box-sizing:border-box;display:grid;gap:8px;overflow:hidden}
 body.upgrade-page .upgrade-library{grid-template-rows:auto minmax(0,1fr) auto}body.upgrade-page .upgrade-market{grid-template-rows:auto auto minmax(0,1fr)}
 body.upgrade-page :is(.upgrade-library,.upgrade-market) .panel-head{margin:0}body.upgrade-page .library-caption{font-size:10px;margin-bottom:3px}body.upgrade-page :is(.upgrade-library,.upgrade-market) h2{font-size:16px}
 body.upgrade-page :is(.inventory-grid,.target-grid){min-height:0;max-height:none;overflow-y:auto;align-content:start;scrollbar-gutter:stable;grid-template-columns:repeat(3,minmax(0,1fr))}
 body.upgrade-page .filters{gap:4px;margin:0}body.upgrade-page .filters :is(input,select,button){min-height:30px;padding:6px 8px;font-size:10px}
 body.upgrade-page :is(.inventory-card,.target-card){padding:7px;gap:5px}body.upgrade-page :is(.inventory-card__media,.target-card__media){min-height:46px;height:46px}body.upgrade-page :is(.inventory-card__media,.target-card__media) img{height:42px}
 body.upgrade-page :is(.inventory-card__name,.target-card__name){font-size:10px;line-height:1.3;min-height:26px}body.upgrade-page :is(.inventory-card__price,.target-card__price){font-size:11px}body.upgrade-page .pagination{margin:0;gap:4px}body.upgrade-page .pagination button{padding:4px 8px;min-height:26px}
 body.upgrade-page :is(.upgrade-library,.upgrade-market) .empty-state{min-height:0;padding:14px}
}

@media(min-width:1101px) and (min-height:720px){
 body.upgrade-page .upgrade-workbench:has(.upgrade-result:is(.is-win,.is-loss)){height:auto;grid-template-rows:minmax(390px,auto) minmax(250px,1fr)}
}

/* Keep flat item art and its label on the shared centre axis. */
body.upgrade-page .target-preview--filled{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;min-width:0}
body.upgrade-page .target-preview__meta{width:100%;min-width:0;text-align:center}
body.upgrade-page .target-preview__image{flex-shrink:0;max-width:100%;object-fit:contain;margin-inline:auto}
body.upgrade-page .target-preview__title{max-width:32ch;margin-inline:auto;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere}
