#workshop {
  --surface: #271d40;
  --edge: #715980;
  --subtle: #d9cce6;
  display: none;
  width: min(430px, calc(100vw - 18px));
  max-height: min(820px, 91dvh);
  padding: 0;
  overflow: hidden;
  border: 2px solid #aa81bc;
  border-radius: 19px;
  color: #fff;
  background: linear-gradient(145deg, #48305e, #291c3c 55%, #22182f);
  box-shadow: 0 14px 60px #0c071ba8;
}
#workshop[open] {display:grid; grid-template-rows:auto auto auto minmax(0,1fr)}
#workshop::backdrop {background:#100b1dd1; backdrop-filter:blur(4px)}
#workshop button {min-height:44px; color:white}
#workshop button:focus-visible {outline:3px solid #fff4b4; outline-offset:2px}
#workshop button:disabled {cursor:default; opacity:.57}
.workshop-head {display:flex; align-items:center; justify-content:space-between; padding:14px 16px 10px}
#workshop-title {font-size:clamp(1.55rem,7vw,2.2rem); font-weight:1000; font-style:italic; letter-spacing:-.035em; line-height:1.1; text-shadow:0 3px #23132e}
.workshop-close {width:44px; border:1px solid #9c79b1; border-radius:11px; background:#362343; font-size:1.55rem; line-height:1}
.workshop-tabs {display:grid; grid-template-columns:1fr 1fr; gap:4px; margin:0 14px 4px; padding:3px; border-radius:12px; background:#1c142c}
.workshop-tab {background:transparent; border:1px solid transparent; border-radius:9px; padding:6px; font-size:1rem}
.workshop-tab[aria-pressed=true] {background:linear-gradient(150deg,#765398,#513669); border-color:#c092e4; box-shadow:0 2px 3px #110a1d66}
.workshop-body {min-height:0; overflow:auto; overscroll-behavior:contain; scrollbar-color:#775a8a #382840; padding:4px 14px max(16px,env(safe-area-inset-bottom))}
#workshop h3 {font-size:1.05rem; font-weight:850; margin:13px 0 8px}
#workshop h4 {font-weight:900; font-size:1rem; margin:0 0 4px}
.workshop-stock {display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px}
.workshop-cell {display:grid; grid-template-columns:auto 1fr; align-items:center; column-gap:6px; row-gap:4px; padding:9px; border-radius:11px; border:1px solid var(--edge); background:linear-gradient(135deg,#433259,var(--surface))}
.workshop-cell strong {font-size:1.2rem; font-variant-numeric:tabular-nums; overflow-wrap:anywhere}
.stock-name {grid-column:1/-1; color:#f6eafa; font-size:.88rem}
.workshop-icon {display:inline-grid; place-items:center; color:var(--icon); background:radial-gradient(ellipse at 30% 14%,#ffffff1a,transparent 60%),var(--tint); width:30px; height:30px; border:1px solid var(--line); border-radius:9px; font-style:normal; font-size:18px; line-height:1; flex:none}
.item-bolt,.item-boots {--tint:#4d3542; --line:#c18a73; --icon:#ffce99}
.item-shard,.item-scanner {--tint:#463361; --line:#ae80d2; --icon:#e6aafe}
.item-coil,.item-magnet {--tint:#25494e; --line:#549c9e; --icon:#89f5dc}
.workshop-tip,.workshop-help {color:var(--subtle); line-height:1.45; font-size:.93rem}
.workshop-tip {border-radius:11px; border:1px dashed #80648f; padding:13px}
.workshop-help {margin:0 0 10px}
.workshop-workbench {margin-top:10px; background:#56386b; border:1px solid #b484d0; border-radius:10px; width:100%; font-size:.96rem}
.workshop-swap,.workshop-card {background:var(--surface); border:1px solid var(--edge); border-radius:12px}
.workshop-swaps {display:grid; gap:5px}
.workshop-swap {display:flex; gap:8px; align-items:center; padding:6px 8px}
.swap-offer {flex:1; min-width:0; font-size:.91rem; line-height:1.3}
.trade-from,.trade-to {white-space:nowrap}
.trade-from {color:var(--subtle)}
.swap-arrow {color:#e9bd70}
#workshop .workshop-action {background:linear-gradient(#ffe58b,#f5b640); color:#291d24; border-radius:9px; border:1px solid #ffc858; font-size:.9rem; padding:6px 10px}
#workshop .workshop-action:disabled {color:#ece0f4; background:#463851; border:1px solid #826e89; opacity:.75}
.workshop-card {margin-top:7px; padding:10px}
.workshop-card.owned {border-color:#548a7e}
.workshop-tool {display:flex; align-items:center; gap:11px}
.workshop-icon.large {width:46px; height:46px; border-radius:11px; font-size:26px}
.workshop-tool p {color:var(--subtle); line-height:1.35; font-size:.88rem}
.workshop-built {display:block; margin-top:8px; font-weight:bold; color:#8de5bf; font-size:.84rem}
.workshop-costs {display:flex; flex-wrap:wrap; gap:5px; align-items:center; margin-top:8px}
.cost-chip {display:inline-flex; align-items:center; gap:3px; font-weight:bold; font-size:.86rem; color:#f5b9a9}
.cost-chip.enough {color:#92f6bf}
.cost-chip .workshop-icon {width:24px; height:24px; background:transparent; border:0}
.workshop-costs button {margin-left:auto}
.workshop-notice {color:#d6ffe7; background:#225145; font-size:.89rem; padding:8px 10px; margin:6px 14px 0; border-radius:8px}
.workshop-notice:empty {display:none}
@media(max-width:360px) {
  .workshop-cell {column-gap:3px; padding:6px}
  .workshop-body {padding-inline:10px}
  .workshop-swap {gap:5px}
  .workshop-swap>.workshop-icon {display:none}
}
