/* Worker B — Rizo Defense economy + universal structures.
   Scoped to Defense so merge workers can lift/remove this file cleanly. */

/* ---------- Universal structure cards ---------- */
.defense-roster-structure{
  --structure-ink:#17151b;
  isolation:isolate;
  background:
    linear-gradient(135deg,color-mix(in srgb,var(--roster-color) 18%,#2a2531),#2a2531 62%);
}
.defense-roster-structure::after{
  content:"";
  position:absolute;
  inset:5px;
  border:1px dashed color-mix(in srgb,var(--roster-color) 52%,transparent);
  border-radius:calc(var(--def-radius-2) - 4px);
  pointer-events:none;
  z-index:-1;
}
.defense-roster-structure .defense-roster-info small{color:#e7ddec;font-weight:850;letter-spacing:.05em}
.defense-roster-structure.placed .defense-roster-info small{color:var(--roster-color)}
.defense-structure-thumb{
  position:relative;
  width:56px;
  height:58px;
  display:block;
  place-self:center;
  overflow:visible;
  filter:drop-shadow(0 3px 0 rgb(0 0 0/.28));
}

/* ---------- Shared on-field structure language ---------- */
.defense-tower.defense-structure{
  width:calc(70px * var(--def-unit-scale));
  height:calc(76px * var(--def-unit-scale));
  translate:-50% -86%;
  filter:drop-shadow(0 0 1.5px var(--play-outline)) drop-shadow(0 5px 2px rgb(20 10 20/.28));
}
.defense-tower.defense-structure::before{
  width:calc(51px * var(--def-unit-scale));
  height:calc(15px * var(--def-unit-scale));
}
.defense-tower.defense-structure .defense-range{bottom:8px}
.defense-structure-art{
  position:absolute;
  left:50%;
  bottom:4px;
  width:calc(60px * var(--def-unit-scale));
  height:calc(58px * var(--def-unit-scale));
  translate:-50% 0;
  pointer-events:none;
  transform-origin:50% 100%;
}
.defense-structure-art > i{position:absolute;display:block;box-sizing:border-box}
.defense-structure-name{
  position:absolute;
  left:50%;
  bottom:-9px;
  translate:-50% 0;
  min-width:43px;
  padding:2px 4px;
  border:1.5px solid #17151b;
  border-radius:5px;
  background:#fff2cf;
  color:#17151b;
  box-shadow:0 2px 0 rgb(23 21 27/.7);
  font:950 7px/1 var(--def-font-mono);
  letter-spacing:.04em;
  text-align:center;
  z-index:5;
}
.defense-structure-field{
  position:absolute;
  left:50%;
  bottom:9px;
  translate:-50% 50%;
  pointer-events:none;
  z-index:-4;
}

/* ---------- Clothing Factory ---------- */
.structure-art-factory::before{
  content:"";
  position:absolute;
  left:6px;
  right:5px;
  bottom:4px;
  height:34px;
  border:3px solid #17151b;
  border-radius:4px 4px 7px 7px;
  background:
    linear-gradient(90deg,transparent 0 12%,rgb(255 255 255/.13) 12% 17%,transparent 17% 100%),
    #d95c35;
  box-shadow:inset 0 -7px 0 rgb(67 35 33/.18),0 2px 0 rgb(0 0 0/.2);
}
.structure-art-factory::after{
  content:"RIZO";
  position:absolute;
  left:9px;
  right:8px;
  top:9px;
  height:13px;
  display:grid;
  place-items:center;
  border:2px solid #17151b;
  border-radius:3px;
  background:#fff1c4;
  color:#17151b;
  font:950 8px/1 var(--def-font-display);
  letter-spacing:.11em;
  box-shadow:0 2px 0 rgb(0 0 0/.16);
}
.structure-art-factory > i:nth-child(1){
  left:12px;bottom:6px;width:14px;height:20px;
  border:2px solid #17151b;border-radius:2px 2px 0 0;background:#392f3c;
}
.structure-art-factory > i:nth-child(1)::after{
  content:"";position:absolute;right:2px;top:9px;width:3px;height:3px;border-radius:50%;background:#ffd96b;
}
/* tiny hanging shirt: the product explains the building */
.structure-art-factory > i:nth-child(2){
  right:11px;bottom:10px;width:15px;height:14px;
  border:2px solid #17151b;border-radius:3px 3px 4px 4px;background:#fff0ca;
  clip-path:polygon(20% 0,38% 0,44% 16%,56% 16%,62% 0,80% 0,100% 26%,83% 40%,77% 31%,77% 100%,23% 100%,23% 31%,17% 40%,0 26%);
}
.structure-art-factory > i:nth-child(3){
  display:none;right:7px;top:1px;width:10px;height:22px;border:2px solid #17151b;border-bottom:0;border-radius:3px 3px 0 0;background:#6f6675;
}
.structure-art-factory > i:nth-child(4){
  display:none;left:1px;bottom:2px;width:58px;height:8px;border:2px solid #17151b;border-radius:99px;background:repeating-linear-gradient(90deg,#847988 0 6px,#c4bac7 6px 10px);
}
.structure-art-factory > i:nth-child(5){
  display:none;left:0;top:20px;width:10px;height:10px;border:2px solid #17151b;border-radius:2px;background:#ffc552;box-shadow:42px 0 0 #ffc552,42px 0 0 2px #17151b;
}
/* bench thumbnail is a self-contained small shop */
.defense-structure-thumb.structure-art-factory::before{left:5px;right:4px;bottom:4px;height:32px}
.defense-structure-thumb.structure-art-factory::after{top:8px}

.defense-structure-factory .defense-structure-field{
  width:calc(64px * var(--def-unit-scale));
  height:calc(18px * var(--def-unit-scale));
  border:2px solid rgb(23 21 27/.8);
  border-radius:50%;
  background:conic-gradient(from 270deg,#ffca5c calc(var(--factory-progress,0) * 1turn),rgb(255 255 255/.12) 0);
  opacity:.68;
  mask:radial-gradient(ellipse,transparent 0 58%,#000 61%);
  -webkit-mask:radial-gradient(ellipse,transparent 0 58%,#000 61%);
}
.defense-structure-factory.defense-upgrade-1 .structure-art-factory{scale:1.03}
.defense-structure-factory.defense-upgrade-1 .structure-art-factory::before{background:linear-gradient(90deg,transparent 0 12%,rgb(255 255 255/.13) 12% 17%,transparent 17% 100%),#ec7440}
.defense-structure-factory.defense-upgrade-2 .structure-art-factory > i:nth-child(3),
.defense-structure-factory.defense-upgrade-2 .structure-art-factory > i:nth-child(4),
.defense-structure-factory.defense-upgrade-3 .structure-art-factory > i:nth-child(3),
.defense-structure-factory.defense-upgrade-3 .structure-art-factory > i:nth-child(4),
.defense-structure-factory.defense-upgrade-4 .structure-art-factory > i:nth-child(3),
.defense-structure-factory.defense-upgrade-4 .structure-art-factory > i:nth-child(4){display:block}
.defense-structure-factory.defense-upgrade-3 .structure-art-factory > i:nth-child(5),
.defense-structure-factory.defense-upgrade-4 .structure-art-factory > i:nth-child(5){display:block}
.defense-structure-factory.defense-upgrade-2 .structure-art-factory::before{left:2px;right:1px;height:39px;background:#e66b36}
.defense-structure-factory.defense-upgrade-3 .structure-art-factory{scale:1.12}
.defense-structure-factory.defense-upgrade-3 .structure-art-factory::before{height:43px;background:linear-gradient(180deg,#f27c3b 0 58%,#c34f31 58%)}
.defense-structure-factory.defense-upgrade-4 .structure-art-factory{scale:1.24;filter:drop-shadow(0 0 8px rgb(255 167 67/.72))}
.defense-structure-factory.defense-upgrade-4 .structure-art-factory::before{
  left:-3px;right:-4px;height:48px;border-radius:2px 2px 8px 8px;
  background:repeating-linear-gradient(90deg,#f27b38 0 12px,#db5f32 12px 17px);
  box-shadow:inset 0 -9px 0 rgb(45 29 31/.2),0 0 0 2px rgb(255 211 91/.35),0 4px 0 rgb(0 0 0/.2);
}
.defense-structure-factory.defense-upgrade-4 .structure-art-factory::after{left:3px;right:2px;top:4px;background:#ffd75a;box-shadow:0 0 8px #ffc84c}
.defense-structure-factory.factory-produced .structure-art-factory{animation:worker-b-factory-stamp .34s cubic-bezier(.2,.9,.25,1.2)}
.defense-structure-factory.beacon-buffed .structure-art-factory{filter:drop-shadow(0 0 7px rgb(255 224 102/.72))}
.defense-factory-payout{
  position:absolute;left:50%;top:1px;translate:-50% -100%;z-index:8;
  display:flex;align-items:center;gap:3px;padding:3px 5px;
  border:2px solid #17151b;border-radius:99px;background:#ffd75a;color:#17151b;
  box-shadow:0 2px 0 rgb(0 0 0/.3);font:950 9px/1 var(--def-font-mono);
  pointer-events:none;animation:worker-b-money-pop .88s ease-out both;
}
.defense-factory-payout > i{width:10px;height:9px;border:1.5px solid #17151b;background:#fff1ca;clip-path:polygon(20% 0,38% 0,44% 16%,56% 16%,62% 0,80% 0,100% 26%,83% 40%,77% 31%,77% 100%,23% 100%,23% 31%,17% 40%,0 26%)}

/* ---------- Beacon ---------- */
.structure-art-beacon::before{
  content:"";position:absolute;left:50%;top:5px;width:25px;height:25px;translate:-50% 0;
  border:3px solid #17151b;border-radius:50%;background:#ffe470;
  box-shadow:inset -4px -4px 0 rgb(219 145 35/.18),0 0 9px rgb(255 225 92/.78);
}
.structure-art-beacon::after{
  content:"";position:absolute;left:50%;bottom:4px;width:10px;height:31px;translate:-50% 0;
  border:2px solid #17151b;border-radius:5px 5px 2px 2px;background:#695f72;
  box-shadow:0 0 0 3px rgb(255 255 255/.08);
}
.structure-art-beacon > i:nth-child(1),.structure-art-beacon > i:nth-child(2),.structure-art-beacon > i:nth-child(3),.structure-art-beacon > i:nth-child(4),.structure-art-beacon > i:nth-child(5){
  left:50%;top:0;width:4px;height:11px;translate:-50% -4px;border-radius:99px;background:#ffe470;box-shadow:0 0 5px #ffd857;transform-origin:2px 19px;
}
.structure-art-beacon > i:nth-child(2){rotate:72deg}.structure-art-beacon > i:nth-child(3){rotate:144deg}.structure-art-beacon > i:nth-child(4){rotate:216deg}.structure-art-beacon > i:nth-child(5){rotate:288deg}
.defense-structure-thumb.structure-art-beacon::before{top:8px;width:23px;height:23px}
.defense-structure-thumb.structure-art-beacon::after{height:26px}
.defense-structure-thumb.structure-art-beacon > i{display:none}

.defense-structure-beacon .defense-structure-field{
  width:var(--tower-range-width,150px);height:var(--tower-range-height,150px);
  border:2px solid rgb(255 224 102/.34);border-radius:50%;
  background:radial-gradient(circle,rgb(255 233 128/.10) 0 45%,rgb(255 224 91/.055) 46% 67%,transparent 68%);
  box-shadow:inset 0 0 20px rgb(255 216 71/.10),0 0 14px rgb(255 216 71/.06);
  opacity:.74;
}
.defense-structure-beacon .defense-structure-field::before,.defense-structure-beacon .defense-structure-field::after{
  content:"";position:absolute;border:1px dashed rgb(255 235 151/.26);border-radius:50%;inset:13%;
}
.defense-structure-beacon .defense-structure-field::after{inset:31%;border-style:solid;opacity:.42}
.defense-structure-beacon.selected .defense-structure-field{opacity:1;border-color:rgb(255 225 92/.64)}
.defense-structure-beacon .defense-range{border-color:rgb(255 224 101/.65);background:transparent}
.defense-structure-beacon.defense-upgrade-1 .structure-art-beacon::before{width:29px;height:29px;top:2px;background:#ffe16a;box-shadow:0 0 13px #ffd54f}
.defense-structure-beacon.defense-upgrade-2 .structure-art-beacon{scale:1.07}
.defense-structure-beacon.defense-upgrade-2 .structure-art-beacon::before{width:34px;height:34px;top:-1px;background:radial-gradient(circle at 38% 32%,#fff9cc 0 13%,#ffe067 15% 70%,#f5a72e 72%)}
.defense-structure-beacon.defense-upgrade-3 .structure-art-beacon{scale:1.16;filter:drop-shadow(0 0 8px rgb(255 225 96/.8))}
.defense-structure-beacon.defense-upgrade-3 .structure-art-beacon::before{width:39px;height:39px;top:-5px;box-shadow:0 0 18px #ffd75a,0 0 30px rgb(255 196 60/.42)}
.defense-structure-beacon.defense-upgrade-4 .structure-art-beacon{scale:1.34;filter:drop-shadow(0 0 10px #ffe374) drop-shadow(0 0 18px rgb(255 181 45/.7))}
.defense-structure-beacon.defense-upgrade-4 .structure-art-beacon::before{width:47px;height:47px;top:-10px;border-width:3px;background:radial-gradient(circle at 38% 32%,#fffef0 0 10%,#fff1a0 13% 35%,#ffd343 39% 70%,#f09427 73%);box-shadow:0 0 12px #fff4b4,0 0 28px #ffd34e,0 0 44px rgb(255 153 38/.65)}
.defense-structure-beacon.defense-upgrade-4 .defense-structure-field{border-width:3px;background:radial-gradient(circle,rgb(255 244 174/.16) 0 30%,rgb(255 215 72/.10) 31% 62%,transparent 65%);box-shadow:inset 0 0 34px rgb(255 219 83/.13),0 0 22px rgb(255 211 67/.12);animation:worker-b-sun-field 2.6s ease-in-out infinite}

/* Strongest Beacon only is mechanical; this halo is the cause/effect lesson. */
.defense-tower.beacon-buffed:not(.defense-structure-beacon)::after{
  box-shadow:0 0 0 2px rgb(255 225 102/.42),0 0 11px rgb(255 218 75/.58),inset 0 0 7px rgb(255 244 177/.3);
  border-color:#ffe56d;
}
.defense-tower.beacon-buffed:not(.defense-structure-beacon) .defense-field-mark{box-shadow:0 0 8px #ffe069,0 2px 0 rgb(23 21 27/.75)}

/* ---------- Structure panel ---------- */
.defense-structure-panel{--panel-accent:#ffd65a}
.defense-structure-panel .defense-panel-portrait{border-color:var(--panel-accent);background:radial-gradient(circle at 50% 42%,color-mix(in srgb,var(--panel-accent) 18%,#17131c),#17131c 70%)}
.defense-structure-panel .defense-structure-thumb{scale:1.08}
.defense-structure-readout{
  grid-column:1/-1;display:grid;gap:.2rem;padding:.55rem .62rem;
  border:2px solid color-mix(in srgb,var(--panel-accent) 52%,#4d4353);
  border-radius:var(--def-radius-2);background:#17131c;
}
.defense-structure-readout b{font:950 var(--def-size-small)/1.15 var(--def-font-display);color:var(--panel-accent)}
.defense-structure-readout span{font:800 var(--def-size-caption)/1.35 var(--def-font-mono);color:#d9cfdf}
.defense-structure-panel .structure-info{opacity:1;cursor:default}
.defense-structure-panel .structure-info > i{background:var(--panel-accent);color:#17151b}

@keyframes worker-b-money-pop{
  0%{opacity:0;transform:translateY(8px) scale(.78)}
  18%{opacity:1;transform:translateY(0) scale(1.08)}
  72%{opacity:1;transform:translateY(-10px) scale(1)}
  100%{opacity:0;transform:translateY(-17px) scale(.92)}
}
@keyframes worker-b-factory-stamp{0%{transform:scale(1)}42%{transform:scale(.93,.98)}72%{transform:scale(1.06,.96)}100%{transform:scale(1)}}
@keyframes worker-b-sun-field{0%,100%{opacity:.78;scale:.995}50%{opacity:1;scale:1.018}}

@media (max-width:430px){
  .defense-roster-structure .defense-structure-thumb{width:48px;height:51px}
  .defense-structure-panel .defense-structure-thumb{width:54px;height:56px}
}
@media (prefers-reduced-motion:reduce){
  .defense-structure-factory.factory-produced .structure-art-factory,
  .defense-factory-payout,
  .defense-structure-beacon.defense-upgrade-4 .defense-structure-field{animation:none}
}
.defense-world.fx-lean .defense-structure-field,.defense-world.fx-potato .defense-structure-field{box-shadow:none;animation:none}

/* ---------- Depth pass: momentum, drops, and brand-loop readability ---------- */
.defense-structure-factory .defense-structure-field::after{
  content:"";position:absolute;inset:-4px;border-radius:50%;pointer-events:none;
  border:2px solid rgb(255 214 90/.72);
  box-shadow:0 0 10px rgb(255 171 64/.42);
  opacity:clamp(.12,var(--factory-momentum,.12),.82);
}
.defense-structure-factory.drop-ready .defense-structure-field{opacity:1;filter:drop-shadow(0 0 7px rgb(255 209 72/.76))}
.defense-structure-factory.drop-ready .structure-art-factory::after{background:#ffe471;box-shadow:0 0 10px #ffd75a}
.defense-structure-factory.factory-drop .structure-art-factory{animation:worker-b-factory-drop .58s cubic-bezier(.2,.9,.22,1.25)}
.defense-structure-factory.factory-golden-drop .structure-art-factory{filter:drop-shadow(0 0 9px #ffe978) drop-shadow(0 0 17px rgb(255 193 47/.7))}
.defense-structure-factory.factory-streak-broken .defense-structure-field{animation:worker-b-streak-break .62s ease-out both}
.defense-factory-payout.drop{gap:4px;padding:4px 7px;background:#fff0a4;box-shadow:0 3px 0 rgb(0 0 0/.34),0 0 14px rgb(255 205 68/.58)}
.defense-factory-payout.drop em{font:950 7px/1 var(--def-font-display);font-style:normal;letter-spacing:.08em}
.defense-factory-payout.golden{background:#ffe66d;box-shadow:0 3px 0 rgb(0 0 0/.34),0 0 18px rgb(255 220 80/.78)}

.defense-structure-beacon.brand-loop .defense-structure-field{
  border-style:solid;background:radial-gradient(circle,rgb(255 245 175/.16) 0 34%,rgb(255 215 72/.10) 35% 63%,transparent 66%);
  box-shadow:inset 0 0 28px rgb(255 223 92/.16),0 0 19px rgb(255 207 57/.14);
}
.defense-structure-beacon.brand-loop .defense-structure-field::before{border-style:solid;border-color:rgb(255 241 166/.44)}
.defense-structure-beacon.private-sun-network .structure-art-beacon::before{box-shadow:0 0 13px #fff5b8,0 0 30px #ffd54d,0 0 50px rgb(255 149 37/.72)}
.defense-structure-beacon.brand-pulse .defense-structure-field{animation:worker-b-brand-pulse .82s ease-out both}
.defense-structure-beacon.golden-brand-pulse .defense-structure-field{animation:worker-b-golden-pulse .82s ease-out both}
.defense-tower.golden-license:not(.defense-structure)::after{box-shadow:0 0 0 2px rgb(255 230 105/.58),0 0 14px rgb(255 199 44/.72),inset 0 0 8px rgb(255 246 184/.35)}

@keyframes worker-b-factory-drop{0%{transform:scale(1)}28%{transform:scale(.88,.96)}56%{transform:scale(1.14,.9)}78%{transform:scale(.98,1.08)}100%{transform:scale(1)}}
@keyframes worker-b-streak-break{0%{filter:none}30%{filter:grayscale(.9) brightness(.72);opacity:.45}100%{filter:none;opacity:.68}}
@keyframes worker-b-brand-pulse{0%{scale:.94;opacity:.58}42%{scale:1.055;opacity:1}100%{scale:1;opacity:.8}}
@keyframes worker-b-golden-pulse{0%{scale:.92;opacity:.58;filter:none}40%{scale:1.075;opacity:1;filter:drop-shadow(0 0 13px #ffe868)}100%{scale:1;opacity:.84;filter:none}}

@media (prefers-reduced-motion:reduce){
  .defense-structure-factory.factory-drop .structure-art-factory,
  .defense-structure-factory.factory-streak-broken .defense-structure-field,
  .defense-structure-beacon.brand-pulse .defense-structure-field,
  .defense-structure-beacon.golden-brand-pulse .defense-structure-field{animation:none}
}

/* Depth-pass effects honor the existing performance tiers too. */
.defense-world.fx-lean .defense-structure-factory.factory-drop .structure-art-factory,
.defense-world.fx-potato .defense-structure-factory.factory-drop .structure-art-factory,
.defense-world.fx-lean .defense-structure-factory.factory-streak-broken .defense-structure-field,
.defense-world.fx-potato .defense-structure-factory.factory-streak-broken .defense-structure-field,
.defense-world.fx-lean .defense-structure-beacon.brand-pulse .defense-structure-field,
.defense-world.fx-potato .defense-structure-beacon.brand-pulse .defense-structure-field,
.defense-world.fx-lean .defense-structure-beacon.golden-brand-pulse .defense-structure-field,
.defense-world.fx-potato .defense-structure-beacon.golden-brand-pulse .defense-structure-field{animation:none}
