.relic-art {
  display: block;
  width: 100%; aspect-ratio: 1;
  background: url("assets/equipment-atlas.png") 0 0 / 400% 200% no-repeat;
  pointer-events: none;
}
.art-rime { background-position: 33.333% 0 }
.art-cinder { background-position: 66.667% 0 }
.art-stormglass { background-position: 100% 0 }
.art-bag { background-position: 0 100% }
.art-frost { background-position: 33.333% 100% }
.art-flame { background-position: 66.667% 100% }
.art-storm { background-position: 100% 100% }

.gear-belt { display: flex; align-items: flex-start; gap: 7px; pointer-events: auto; margin: 3px 0 4px }
.gear-belt button {
  position: relative; display: grid; place-items: center; padding: 3px; width: 54px; height: 54px;
  border: 2px solid #d5aa62; border-radius: 50%; color: #ffe6aa;
  background: radial-gradient(ellipse at 38% 30%, #666c59, #273c3c 59%, #152424 76%);
  box-shadow: inset 0 0 0 2px #4e412e, inset 0 0 0 3px #be975a, 0 3px 0 #342a22, 0 4px 6px #101e1c88;
}
.gear-belt #bagButton .relic-art { width: 88%; filter: drop-shadow(0 2px 1px #110c0a) }
.gear-belt #fieldSocket { width: 46px; height: 46px; margin-top: 5px }
.gear-belt .belt-art { display: grid; place-items: center; width: 78%; aspect-ratio: 1 }
.belt-art i { width: 23px; height: 23px; color: #9ab4ab }
.belt-name {
  position: absolute; bottom: -7px; width: max-content; max-width: 77px;
  background: linear-gradient(#5f4b34,#342b23); border: 1px solid #b99458; padding: 0 5px;
  color: #ffedc8; font: 800 10px/14px var(--font); text-shadow: 0 1px 2px #15110e; white-space: nowrap;
}

#layer.gear-open {
  grid-template: minmax(0,1fr) / minmax(0,1fr);
  background: #0a1013e8; backdrop-filter: blur(2px);
  padding: max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));
}
.gear-open .dialog {
  width: min(1050px,100%); height: min(730px,100%); max-height: 100%; padding: 4px; overflow: hidden;
  border: 1px solid #e8bc78; border-radius: 9px;
  background: linear-gradient(120deg,#e1b46c,#5e4935 15%,#ac8049 40%,#4b382c 76%,#ae804b);
  box-shadow: inset 0 0 0 1px #3a2a20, 0 9px 30px #040607b3;
}
.gear-open #content,.equipment-frame { height: 100%; min-height: 0 }
.equipment-frame {
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid #171a18; border-radius: 5px;
  color: #ffebc5; background: #1d2729; --line: #aa8555;
}
.gear-header {
  position: relative; display: flex; flex: 0 0 56px; align-items: center; gap: 12px; padding: 0 62px 0 17px;
  border-bottom: 3px ridge #a88859;
  background: repeating-linear-gradient(3deg,transparent 0 7px,#fff0bc06 8px,transparent 10px 19px),linear-gradient(#544033,#372c27 55%,#2d2420);
  box-shadow: inset 0 1px #bd9a63, inset 0 -2px #1f1916; z-index: 1;
}
.heading-satchel { width: 32px; filter: drop-shadow(1px 2px 1px #120e0b) }
.gear-header h2 { margin: 0; color: #ffdf9a; font: 800 clamp(22px,3vw,32px)/1 var(--title); letter-spacing: .035em; text-transform: uppercase; text-shadow: 1px 2px #1b1512 }
.gold-counter { margin-left: auto; display: flex; gap: 6px; align-items: center; color: #ffe2a0; font: 750 14px var(--font); font-variant-numeric: tabular-nums }
.gold-counter i { width: 17px; color: #efb75b; filter: drop-shadow(0 1px #30190c) }
.gear-open .dialog #close {
  z-index: 3; right: 12px; top: 11px; width: 40px; height: 40px; border: 2px solid #cc9e66; border-radius: 6px;
  background: linear-gradient(#ac5d40,#703524 65%,#542b22); color: #ffe7c0;
  box-shadow: inset 0 0 0 1px #533024,inset 0 2px #e68e66,0 2px 0 #241e19;
}
.gear-open .dialog #close i { width: 16px; height: 16px }
.equipment-body { display: grid; flex: 1; min-height: 0; grid-template-columns: minmax(0,1.05fr) minmax(0,1fr) }
.figure-scene {
  isolation: isolate; position: relative; overflow: hidden; min-height: 0;
  background: linear-gradient(180deg,#07141d6e,#0619250d 47%,#091d2261),url("assets/lookout.jpg") center 57% / cover;
  box-shadow: inset 0 0 32px #0e24267a;
}
#figureHost { position: absolute; inset: 3% 0 4%; }
#figureHost #world { cursor: grab; outline-offset: -5px }
#figureHost #world:active { cursor: grabbing }
.figure-title { position:absolute; top: 13px; left: 16px; pointer-events:none; text-shadow: 0 2px 3px #0e171c,0 0 9px #111f23; }
.figure-title strong { display: block; font: 700 clamp(21px,3.8vw,35px)/1 var(--title); color: #fff1d2 }
.figure-title small { font-size: 12px; font-weight: 750; color: #ffe1a0 }
.figure-vitals {
  position:absolute; left:50%; bottom:10px; transform:translateX(-50%); display:flex; gap:14px; padding: 4px 12px;
  background: linear-gradient(90deg,transparent,#142123e8 14% 86%,transparent); pointer-events:none; white-space:nowrap;
}
.figure-vitals span { display:flex; align-items:center; gap:5px; font:750 12px var(--font) }
.figure-vitals i { width:14px;height:14px;color:#ffd082 }
.figure-vitals span:first-child i { color:#efa18b }
.equipped-slot { position:absolute; top:45%; transform:translateY(-50%); width: clamp(53px,6.8vw,78px); text-align:center }
.slot-weapon { left: 5% }.slot-rune { right: 5% }
.slot-secondary{right:5%;top:32%}.slot-rune{top:72%;width:clamp(44px,5.1vw,60px)}
.equipped-slot>span {
  display:inline-block; position:relative; margin-top:-1px; min-width:85%; padding:1px 3px; border:1px solid #af8d56;
  background:linear-gradient(#4c3b2a,#30271f); color:#ffdf9e; font:800 10px/1.3 var(--font); letter-spacing:.04em; text-transform:uppercase;
}
.equipped-slot>b {display:block;width:max-content;max-width:145%;position:relative;left:50%;transform:translateX(-50%);margin-top:3px;padding:1px 5px;background:#102026d9;border-radius:3px;color:#ffedc8;font:700 11px/1.2 var(--font);pointer-events:none}
.pack {
  display: grid; grid-template-columns:minmax(0,1fr); grid-template-rows: auto minmax(0,1fr) auto; min-height: 0; min-width: 0;
  background: linear-gradient(135deg,#263331,#182426 65%);border-left:3px ridge #a28155;
}
.gear-tabs { display:flex; gap:3px; padding:5px 8px 0; border-bottom:2px solid #a68453; background:linear-gradient(#303633,#212724); }
.gear-tabs button {
  min-height:42px; min-width:0; padding:2px 3px; display:flex; align-items:center; justify-content:center; gap:6px; flex:1; border:1px solid #625842; border-bottom:0;
  border-radius:5px 5px 0 0; background:linear-gradient(#364340,#24312f); color:#c8ccba;
  font:750 14px var(--title); letter-spacing:.06em; text-transform:uppercase;
}
.gear-tabs button[aria-pressed=true] { border-color:#c49c64; color:#ffe2a6; background:linear-gradient(#69563d,#44392d); box-shadow:inset 0 2px #d6b478 }
.gear-tabs i { width:15px;height:15px }
.pack-well {
  padding:12px; min-height:0; overflow-y:auto; overscroll-behavior:contain;
  background:repeating-linear-gradient(0deg,#171c1915 0 3px,transparent 3px 8px),radial-gradient(ellipse at top,#49463a,#2c2d27 70%);scrollbar-color:#887550 #282b25;
}
.slot-grid { display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-content:start;gap:5px }
.rack-slot {
  position:relative; display:grid; place-items:center; width:100%; min-width:0; aspect-ratio:1; padding:6%; border-radius:4px;
  border:2px solid var(--rarity,#6d6c57); color:#f8eaca;
  background:radial-gradient(ellipse at 50% 70%,var(--well,#505b51),#172a2c 80%);
  box-shadow:inset 0 0 0 2px #111717d9,inset 0 -7px 14px #070d108f,0 1px 2px #101410;
}
.rack-slot.q1 {--well:#315e83}.rack-slot.q2 {--well:#654180}.rack-slot.q3 {--well:#8a6030}
.rack-slot .relic-art { width:92%;filter:drop-shadow(1px 2px 1px #0c0c10a6) }
.rack-slot.vacant { border:1px solid #676553; background:linear-gradient(135deg,#192323,#303a32); box-shadow:inset 1px 2px 5px #0c1212b3,0 1px #99836138 }
.rack-slot.vacant::after { content:'';width:13%;height:13%;transform:rotate(45deg);border:1px solid #89958021 }
.rack-slot.chosen { outline:2px solid #ffe6a0; outline-offset:0;z-index:1;box-shadow:inset 0 0 9px #ffe3a280,0 0 6px #ffcd6966 }
.rack-slot.chosen:after { content:'';position:absolute;inset:2px;border:1px solid #ffeea77d;border-radius:1px;pointer-events:none }
.worn-mark,.stack-count,.slot-hit { position:absolute; z-index:1; font:800 11px/1.12 var(--font);text-shadow:0 1px 2px #080a0b,1px 0 #080a0b,-1px 0 #080a0b }
.worn-mark {left:0;top:0;padding:1px 4px 2px 2px;color:#172125;background:#f1d491;clip-path:polygon(0 0,100% 0,100% 65%,55% 100%,0 100%);text-shadow:none }
.stack-count {right:3px;top:3px}.slot-hit {bottom:2px;left:2px;padding:1px 4px;color:#fff4d5;background:#0e1618ce;border-radius:2px}
.gear-inspector {
  padding:12px 14px 10px; border-top:3px ridge #ab8b57;
  background:radial-gradient(ellipse at 5% 0,#39413b,#222c2b 61%);box-shadow:inset 0 1px #e3c18a2e;
}
.item-summary {display:flex;align-items:center;gap:9px}
.inspect-art {flex:none;width:38px;filter:drop-shadow(0 2px 2px #101512)}
.item-summary small {color:var(--rarity);font-size:11px;font-weight:750}
.item-summary h3,.empty-socket h3 {margin:0;color:#ffebbe;font:700 clamp(20px,2.4vw,27px)/1.05 var(--title)}
.inspect-hit {margin-left:auto;display:flex;gap:4px;align-items:center;font:700 19px var(--title)}
.inspect-hit i {width:15px;height:15px;color:#f5ce83}.inspect-hit .gain {color:#ade4ab}.inspect-hit .loss {color:#ffb59c}
.dialog .item-effect,.empty-socket p {margin:5px 0 8px;color:#d9ddcf;font:500 13px/1.3 var(--font)}
.gear-actions {display:flex;gap:6px}
.gear-action {
  display:flex;justify-content:center;align-items:center;gap:7px;flex:1;min-width:0;min-height:42px;padding:4px;
  border:2px solid #caa569;border-radius:5px;
  color:#ffe9b6;background:linear-gradient(#6f6547 0%,#4b4836 51%,#3b3b30 52%,#454131);
  box-shadow:inset 0 0 0 1px #473b29,inset 0 2px #efcf83,0 2px #101718;
  font:800 14px/1.05 var(--font);text-shadow:0 1px 2px #352d20;
}
.gear-action:first-child:not(:disabled) {background:linear-gradient(#527d70,#385f55 50%,#2b514a 51%,#345d51)}
.gear-action:disabled {color:#c3bfab;border-color:#857b60;background:linear-gradient(#4a5046,#363d35);box-shadow:inset 0 1px #8e9176,0 2px #151d1a}
.gear-action i {width:17px;height:17px}.fuse-cost {display:block;margin-top:6px;color:#c9cabe;font-size:10px}
.empty-socket {padding:8px 0;text-align:center}.empty-socket>i {color:#dfcb9a}
.show-roster .slot-grid {grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.orb-counter {display:flex;align-items:center;gap:4px;color:#99efd0;font-weight:800;font-variant-numeric:tabular-nums}
.orb-counter i {width:17px;height:17px}
.hero-card[data-hero=kestrel] {background:radial-gradient(ellipse at 50% 35%,#849e76,#39594d 64%,#1b3030)}
.show-power .slot-grid {display:block;height:100%}
.power-board {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:center;gap:4px;position:relative;isolation:isolate;height:100%;min-height:170px;padding:8px 8px 16px;
  background:repeating-radial-gradient(circle at 50% 47%,transparent 0 32px,#bad2ab0f 33px,transparent 34px 46px),radial-gradient(ellipse at 50% 48%,#364e45,#1b3030 63%,#142222);
  border:3px double #777457;box-shadow:inset 0 0 17px #121e1c}
.power-caption {position:absolute;top:8%;width:100%;text-align:center;font:700 12px var(--title);text-transform:uppercase;letter-spacing:.13em;color:#d4be8f}
.power-board::before {content:"";position:absolute;z-index:-1;top:39%;left:17%;right:17%;height:31%;background:#a49362;clip-path:polygon(0 0,50% 94%,100% 0,100% 5%,50% 100%,0 5%)}
.power-node {--stone:#895f41;background:transparent;border:0;box-shadow:none;padding:0 2px;display:grid;justify-items:center;gap:3px;color:#e5ddc7}
.power-node[data-power=health] {--stone:#803e45;align-self:end}.power-node[data-power=critical] {--stone:#46588a}
.power-stone {display:grid;place-items:center;width:50px;height:50px;border-radius:50%;border:3px double #b49b69;color:#fff0c2;background:radial-gradient(at 35% 22%,var(--stone) 28%,#202c30 93%);box-shadow:0 3px 0 #161c1d,inset 0 0 0 2px #202828}
.power-node.chosen .power-stone {border-color:#ffe8a6;box-shadow:0 0 9px #e6c87686,inset 0 0 0 2px #423e30}
.power-stone i {width:23px;height:23px}.power-node b {font:700 15px var(--title)}.power-node small {font:650 11px var(--font);color:#bfccbc}
.power-heading {display:flex;align-items:center;justify-content:space-between;gap:7px}.power-heading b {font:700 19px var(--title)}.power-heading strong {color:#ade4be}
@media(max-width:440px){.gear-tabs button{padding-inline:1px;gap:3px;font-size:12px;letter-spacing:0}.gear-tabs i{width:12px;flex-shrink:0}.gear-tabs{gap:2px}.hero-card .card-active{top:20px;right:3px}}
@media(max-height:520px){.power-board{min-height:130px;padding-bottom:5px}.power-caption{font-size:10px;top:3%}.power-stone{width:38px;height:38px}.power-node{gap:1px}}
.hero-card {
  position:relative; isolation:isolate; overflow:hidden; min-width:0; height:clamp(115px,20vmin,170px); padding:0;
  border:2px solid #857763; border-radius:5px; background:radial-gradient(ellipse at 50% 37%,#758277,#364a49 65%,#192827);
  box-shadow:inset 0 0 0 2px #302c25,0 2px 3px #101716;
}
.hero-card[data-hero=bryn] {background:radial-gradient(ellipse at 50% 37%,#b48a63,#645044 65%,#352b26)}
.hero-card.chosen {border-color:#ffe2a1;box-shadow:inset 0 0 0 2px #8e653e,0 0 0 1px #e4ad67}
.hero-card img {width:100%;height:100%;display:block;object-fit:contain;object-position:center bottom;pointer-events:none}
.card-caption {position:absolute;inset:auto 0 0;display:grid;justify-items:start;padding:12px 8px 5px;
  background:linear-gradient(transparent,#132020e8 55%,#111b1bf5);color:#fff1d2;text-align:left}
.card-caption b {font:700 19px/1 var(--title)}.card-caption small {font:650 11px/1.3 var(--font);color:#ded9bf}
.card-level,.card-active {position:absolute;top:3px;padding:2px 5px;background:#1a2629ed;font:800 10px/1.3 var(--font);border-radius:2px}
.card-level {left:3px;color:#ffedc8}.card-active {right:3px;background:#f2d492;color:#322b20}
.hero-details {grid-column:1/-1;color:#eaddc2;padding:5px 3px}
.hero-rank,.hero-level,.hero-ability {display:flex;align-items:center;gap:6px}
.hero-rank {padding-bottom:6px;border-bottom:1px solid #9183676b}
.hero-rank strong {color:var(--rarity);font:700 20px/1.2 var(--title)}
.hero-rank span,.hero-level span,.hero-ability span {margin-left:auto;font:650 12px var(--font);color:#d8d6c4}
.hero-level {margin-top:7px;font-size:12px}
.hero-details progress {display:block;width:100%;height:7px;margin:4px 0 12px;border:1px solid #796c50;border-radius:4px;overflow:hidden;background:#142326}
.hero-details progress::-webkit-progress-bar {background:#142326}.hero-details progress::-webkit-progress-value {background:#91c9bc}
.hero-ability {color:#ffe0a0;font:700 17px var(--title)}.hero-ability i {width:17px;height:17px}
.dialog .hero-details p {margin:3px 0;color:#e2ddcc;font:500 13px/1.3 var(--font)}
.crest .field-portrait {width:100%;height:100%;object-fit:cover;pointer-events:none}
@media (max-aspect-ratio:1/1) {
  #layer.gear-open {padding:max(4px,env(safe-area-inset-top)) max(4px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left))}
  .gear-open .dialog {height:min(910px,100%);max-width:620px}
  .equipment-body {grid-template-columns:1fr;grid-template-rows:minmax(0,.78fr) minmax(0,1fr)}
  .pack {border-left:0;border-top:3px ridge #a28155}
  .figure-title {top:10px;left:13px}.pack-well {padding:8px}.equipped-slot{width:clamp(53px,16vw,76px)}
  .gear-inspector {padding:8px 11px}.gear-header{gap:8px;padding-left:12px}.gear-header h2{font-size:24px}
}
@media (max-height:520px) {
  .gear-header {flex-basis:42px;padding-left:10px}.gear-header h2{font-size:21px}.heading-satchel{width:26px}
  .gear-open .dialog #close{width:43px;height:39px;top:7px;right:9px}.gear-tabs button{min-height:40px;font-size:12px}
  .gear-tabs{padding-top:2px}.pack-well{padding:6px 9px}.gear-inspector{padding:5px 10px 6px}
  .inspect-art{width:29px}.item-summary h3{font-size:18px}.gear-action{min-height:42px;font-size:13px}
  .dialog .item-effect{font-size:11px;margin:2px 0 5px}.fuse-cost{margin-top:3px}.figure-vitals{bottom:4px}
}
@media (max-width:360px) {
  .gear-tabs {padding-inline:4px}.gear-tabs button{font-size:12px;gap:3px;letter-spacing:.025em}
  .gear-header{gap:5px}.gear-header h2{font-size:20px}.heading-satchel{width:25px}.gear-tabs button{min-height:40px}
  .gear-inspector{padding:5px 8px}.gear-action{min-height:42px}.gear-header{flex-basis:46px}.gear-open .dialog #close{width:42px;height:40px;top:9px}
}
@media (max-height:650px) {
  .hero-card {height:91px}.show-roster .slot-grid {gap:6px}
  .hero-rank {padding-bottom:3px}.hero-details progress {margin-bottom:6px}
}
