#corner-figure {
  --art-h:min(33vh,275px);
  --art-w:min(188px,20vh,calc(100% - clamp(118px,9vw,168px) - 8px));
  --rack-brass:#d7b88f;
  position:fixed;left:max(12px,env(safe-area-inset-left));bottom:max(12px,env(safe-area-inset-bottom));
  width:calc((100vw - 720px) / 2 - 22px);display:flex;flex-direction:column;align-items:flex-start;gap:4px;z-index:3;pointer-events:none;
}
.figure-bar {display:inline-flex;align-items:center;gap:4px;pointer-events:auto}
#figure-gear-btn {display:inline-flex;align-items:center;min-height:32px;padding:3px 9px;color:#e5d2b7;background:#202024eb;border:1px solid #6b5e54;border-radius:3px;font:12px/1.2 var(--serif);pointer-events:auto;cursor:pointer;touch-action:manipulation}
#figure-gear-btn:hover,#figure-gear-btn[aria-expanded=true] {background:#3b322f;border-color:#a58b6a;color:#fff2dc}
#corner-figure [hidden] {display:none!important}
#figure-inspect {
  appearance:none;display:grid;grid-template-rows:minmax(0,1fr) auto;justify-items:center;
  width:var(--art-w);height:var(--art-h);min-width:44px;min-height:44px;padding:0;border:0;border-radius:3px;
  background:transparent;cursor:pointer;pointer-events:auto;touch-action:manipulation;
}
#figure-inspect #corner-klein {display:block;width:100%;height:100%;object-fit:contain;object-position:center bottom;filter:drop-shadow(2px 6px 4px #0a0a0d8c);pointer-events:none;user-select:none}
.figure-gear-label {display:grid;place-items:center;padding:2px 4px;border:1px solid #736152;border-radius:3px;background:#242125eb;color:#e5d2b7;font:12px/1.25 var(--serif);white-space:nowrap}
.figure-gear-label svg {width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}
@media(min-width:1000px){#figure-inspect .figure-gear-label{display:none}}
#figure-inspect:hover .figure-gear-label,#figure-inspect[aria-expanded=true] .figure-gear-label {background:#3b322f;border-color:#a58b6a}
#figure-inspect:focus-visible {outline:1px dashed #c9aa80;outline-offset:2px}
#figure-toggle {display:inline-flex;align-items:center;min-height:32px;min-width:34px;padding:3px 6px;color:#d6c5b5;background:#202024eb;border:1px solid #6b5e54;border-radius:3px;font:12px/1.2 var(--serif);pointer-events:auto;touch-action:manipulation}
#figure-toggle svg {width:20px;height:20px;stroke:currentColor;stroke-width:1.45;stroke-linecap:round;stroke-linejoin:round;fill:none}
#figure-toggle:hover {background:#363033;color:#f2e3d6}

#figure-rack {
  position:absolute;left:calc(var(--art-w) + 8px);right:0;bottom:35px;max-width:220px;max-height:var(--art-h);
  display:flex;flex-direction:column;align-items:stretch;gap:4px;min-width:0;pointer-events:auto;
}
.rack-bar {flex:none;display:flex;align-items:center;justify-content:space-between;gap:3px;min-width:0;border:1px solid #706053;border-radius:3px;padding:1px 4px;background:#211e22f5;color:var(--rack-brass)}
.rack-bar select {font:13px/1.3 var(--serif);min-height:31px;min-width:0;width:auto;max-width:100%;margin:0;padding:2px;border:none;background:#262327;color:#eadbc8;cursor:pointer}
.rack-bar span {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#c0afa1;font:11px/1.25 Georgia,var(--serif)}
#rack-slots {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;min-height:0;overflow:auto;overscroll-behavior:contain}
#rack-slots button {pointer-events:auto;touch-action:manipulation;color:#bdafa4;background:#222024f0;border:1px solid #60574f;cursor:pointer;border-radius:3px}
#rack-slots button:focus-visible,#rack-slots button:hover {outline:1px solid #dab993;outline-offset:-2px;background:#373033}
#rack-slots .rack-slot {position:relative;min-height:0;height:clamp(44px,6.1vh,56px);display:flex;align-items:center;justify-content:center;flex-direction:column;gap:1px;width:100%;padding:2px 3px;line-height:1.15}
#rack-slots .rack-slot svg {flex:none;width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.45;stroke-linecap:round;stroke-linejoin:round}
#rack-slots .rack-slot span,#rack-slots .rack-slot small {display:block;width:100%;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font:11px/1.15 var(--serif);text-align:center}
#rack-slots .rack-slot small {color:#f3e6d8;font-size:12px}
#rack-slots .rack-slot[data-worn=true] {color:var(--rack-brass);border-color:#a3896c;background:linear-gradient(140deg,#463a34,#292429 78%);box-shadow:inset 0 0 0 2px #312b2a}
#rack-slots .rack-slot i {position:absolute;right:2px;top:2px;font:10px Georgia;color:#dabda6}
#rack-slots.rack-detail {display:flex;flex-direction:column}
#rack-slots.rack-detail button {flex:none;min-height:40px;padding:4px;overflow-wrap:anywhere;font-size:12px}

@media(min-width:1000px) {
  .corner-portrait-visible .fog-setting:after {visibility:hidden}
}
@media(min-width:1000px) and (max-width:1319px) {
  #corner-figure {--art-w:min(100%,20vh,188px);align-items:flex-start}
  #figure-rack {left:0;right:auto;bottom:calc(100% + 6px);width:min(220px,calc(100vw - 32px));max-height:min(42vh,320px);z-index:6;padding:5px;background:#1b191ef7;border:1px solid #706053;border-radius:4px;box-shadow:0 12px 32px #000a}
}
@media(max-width:999px) {
  #corner-figure {--art-w:clamp(58px,10vh,88px);--art-h:clamp(68px,13vh,106px);position:relative;inset:auto;width:100%;margin:0 0 3px;z-index:auto}
  #figure-toggle svg {width:17px;height:17px}
  #figure-rack {left:calc(var(--art-w) + 8px);top:0;bottom:0;max-width:330px;max-height:none}
  #rack-slots {grid-template-columns:repeat(auto-fit,minmax(44px,1fr));gap:3px}
  #rack-slots .rack-slot {height:46px}
  #rack-slots .rack-slot small {font-size:11px}
}
@media(prefers-reduced-motion:no-preference) {
  #corner-klein:not([hidden]) {animation:klein-unfold .25s ease-out both}
  @keyframes klein-unfold {from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:none}}
  #figure-rack:not([hidden]) .rack-slot {animation:unfold-slot .19s ease-out both}
  @keyframes unfold-slot {from{opacity:0}to{opacity:1}}
}
