/* FiveM CEF: page must stay fully transparent — no full-screen fill */
html {
  background: transparent !important;
  background-color: rgba(0, 0, 0, 0) !important;
}
body {
  background: transparent !important;
  background-color: rgba(0, 0, 0, 0) !important;
}
html, body, #app {
  margin: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  background: transparent !important;
  background-color: rgba(0, 0, 0, 0) !important;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--inv-text, #d5d9e2);
  user-select: none;
}
.hidden { display: none !important; }

/* Shared layout tokens — keep boards/equip in sync */
:root {
  --inv-cell-scale: 1;
  --inv-gap-scale: 1;
  --inv-radius: 14px;
  --inv-blur: 0px;
  --inv-shadow: 1;
  --inv-font-scale: 1;
  --inv-ui-scale: 1;
  --inv-pad-scale: 1;
  --cell: calc(clamp(44px, 4.35vmin, 56px) * var(--inv-cell-scale, 1));
  --gap: calc(4px * var(--inv-gap-scale, 1));
  --panel-gap: calc(4px * var(--inv-pad-scale, 1));
  --panel-pad: calc(14px * var(--inv-pad-scale, 1));
  --equip-frame: calc(clamp(68px, 7.2vmin, 80px) * var(--inv-cell-scale, 1));
  --zone-spacer: calc(14px * var(--inv-pad-scale, 1));
  --inv-text-muted: #8b93a7;
  --inv-item-bg: rgba(16, 18, 26, 0.85);
  --inv-item-border: rgba(255, 255, 255, 0.12);
  --inv-btn-bg: rgba(255, 255, 255, 0.05);
  --inv-btn-primary: var(--inv-accent, #6ea8ff);
  --inv-equip-zone: rgba(255, 255, 255, 0.03);
  --inv-valid: rgba(72, 210, 130, 0.9);
  --inv-invalid: rgba(255, 88, 88, 0.9);
  --inv-badge-bg: rgba(255, 255, 255, 0.06);
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: calc(15px * var(--inv-font-scale, 1));
  /* World blur is native (client TriggerScreenblurFadeIn) — CEF backdrop-filter blacks out */
  background: transparent !important;
  background-color: rgba(0, 0, 0, 0) !important;
  box-shadow: none !important;
}
#app:not(.hidden) { pointer-events: auto; }
/* Soft dim over blurred world (no backdrop-filter) */
#app:not(.hidden)::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  transition: opacity 0.35s ease;
}
#app.is-open:not(.hidden)::before {
  opacity: 1;
}
#app.is-closing::before {
  opacity: 0;
  transition: opacity 0.2s ease;
}
#app .inv-wrap {
  position: relative;
  z-index: 1;
}

.inv-wrap {
  display: flex;
  gap: var(--panel-gap);
  /* Don't stretch panels to equal height — avoids empty bottom dead space */
  align-items: flex-start;
  max-height: min(92vh, 980px);
  max-width: min(96vw, 1680px);
  padding: 1.5vh 2vw 1vh;
  box-sizing: border-box;
  transform-origin: center center;
  /* Open/close shell animation */
  opacity: 0;
  transform: scale(calc(var(--inv-ui-scale, 1) * 0.94)) translateY(14px);
  transition:
    opacity 0.2s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    gap 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
#app.is-open .inv-wrap {
  opacity: 1;
  transform: scale(var(--inv-ui-scale, 1)) translateY(0);
}
#app.is-closing .inv-wrap {
  opacity: 0;
  transform: scale(calc(var(--inv-ui-scale, 1) * 0.96)) translateY(10px);
  transition:
    opacity 0.16s ease,
    transform 0.18s cubic-bezier(0.4, 0, 0.7, 0.2);
}

/* Item / equip load-in */
@keyframes du-item-in {
  from {
    opacity: 0;
    transform: scale(0.86);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.item.item-enter {
  animation: du-item-in 0.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.equip-frame .item.item-enter {
  animation-duration: 0.18s;
}
.equip-frame.item-enter-frame {
  animation: du-item-in 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.panel {
  --fold-ease: cubic-bezier(0.34, 1.25, 0.64, 1);
  --fold-dur: 0.42s;
  background: var(--inv-panel-bg, rgba(12, 14, 20, 0.97));
  border: 1px solid var(--inv-panel-border, rgba(255, 255, 255, 0.09));
  border-radius: var(--inv-radius, 14px);
  box-shadow: 0 calc(12px * var(--inv-shadow, 1)) calc(36px * var(--inv-shadow, 1)) rgba(0, 0, 0, calc(0.45 * var(--inv-shadow, 1)));
  padding: var(--panel-pad);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  position: relative;
  /* backdrop-filter is applied via JS only when blur > 0 (CEF blacks out page if always set) */
}

/* —— Fold controls on PLAYER bag panel (left = loadout, right = drop) —— */
.bag {
  position: relative;
  flex: 0 1 auto;
}
.bag-side-fold,
.panel-fold-tab {
  display: none !important;
}
.bag-side-fold-unused {
  position: absolute;
  top: 42%;
  z-index: 30;
  width: 16px;
  height: 32px;
  margin: 0;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(14, 18, 28, 0.94);
  color: #e8eef8;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.25s ease,
    transform 0.35s var(--fold-ease, cubic-bezier(0.34, 1.25, 0.64, 1));
}
.bag-side-fold:hover {
  background: color-mix(in srgb, var(--inv-accent, #6ea8ff) 28%, rgba(14, 18, 28, 0.96));
  border-color: color-mix(in srgb, var(--inv-accent, #6ea8ff) 55%, transparent);
  color: #fff;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--inv-accent, #6ea8ff) 35%, transparent), 0 6px 16px rgba(0, 0, 0, 0.45);
  transform: translateY(-50%) scale(1.08);
}
.bag-side-fold:active {
  transform: translateY(-50%) scale(0.94);
}
.bag-side-fold-left {
  left: -8px;
}
.bag-side-fold-right {
  right: -8px;
}
/* When side panel is folded, arrow accent + nudge */
.bag-side-fold.is-side-folded {
  color: var(--inv-accent, #6ea8ff);
  border-color: color-mix(in srgb, var(--inv-accent, #6ea8ff) 45%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--inv-accent, #6ea8ff) 25%, transparent),
    0 0 16px color-mix(in srgb, var(--inv-accent, #6ea8ff) 22%, transparent),
    0 6px 16px rgba(0, 0, 0, 0.4);
}
.bag-side-fold.is-side-folded.bag-side-fold-left {
  animation: none; /* infinite nudge froze CEF for some clients */
}
.bag-side-fold.is-side-folded.bag-side-fold-right {
  animation: none;
}
.bag-side-fold.is-press {
  animation: bag-fold-press 0.38s var(--fold-ease, cubic-bezier(0.34, 1.25, 0.64, 1));
}
@keyframes bag-fold-press {
  0% { transform: translateY(-50%) scale(1); }
  35% { transform: translateY(-50%) scale(0.86); }
  70% { transform: translateY(-50%) scale(1.12); }
  100% { transform: translateY(-50%) scale(1); }
}
@keyframes bag-fold-nudge-left {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(-3px); }
}
@keyframes bag-fold-nudge-right {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(3px); }
}

.panel-fold-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  flex: 1 1 auto;
  transform-origin: center center;
  will-change: opacity, transform;
}
/* Side tabs removed when folded — only bag-edge arrows remain */
.panel-fold-tab {
  display: none !important;
}

/* ── Fold: equip (simple) + drop (clean slide-in, no bounce/blur) ── */
#equipPanel,
#rightPanel {
  --side-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --side-dur: 0.38s;
  overflow: hidden;
  flex-shrink: 0;
}

/*
 * Loadout (equip) — sideways slide-in from the LEFT (mirror of drop zone).
 * Width/max-width grow horizontally; content translates on X only.
 */
#equipPanel {
  width: max-content;
  min-width: calc(var(--equip-frame) + 28px);
  max-width: calc(var(--equip-frame) + 80px);
  opacity: 1;
  transition:
    max-width 0.4s var(--side-ease),
    width 0.4s var(--side-ease),
    min-width 0.4s var(--side-ease),
    padding 0.36s var(--side-ease),
    margin 0.36s var(--side-ease),
    opacity 0.26s ease 0.05s,
    border-color 0.22s ease,
    box-shadow 0.4s var(--side-ease);
}
#equipPanel .panel-fold-body {
  min-width: calc(var(--equip-frame) + 4px);
  width: max-content;
  transition:
    opacity 0.3s ease 0.06s,
    transform 0.4s var(--side-ease);
  transform: translateX(0);
  opacity: 1;
}
/* Stagger children in from the left when opening */
#equipPanel:not(.is-folded) .panel-fold-body > * {
  animation: equip-child-in 0.34s var(--side-ease) both;
}
#equipPanel:not(.is-folded) .panel-fold-body > .kicker { animation-delay: 0.03s; }
#equipPanel:not(.is-folded) .panel-fold-body > h2 { animation-delay: 0.06s; }
#equipPanel:not(.is-folded) .panel-fold-body > .equip-slots,
#equipPanel:not(.is-folded) .panel-fold-body > #equipSlots { animation-delay: 0.1s; }
@keyframes equip-child-in {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

/*
 * Drop zone clean reveal:
 * panel max-width grows smoothly → content fades/slides in with stagger
 * no spring overshoot, no blur (sharp in CEF)
 */
#rightPanel {
  width: max-content;
  max-width: min(460px, 48vw);
  min-width: 0;
  opacity: 1;
  transition:
    max-width 0.4s var(--side-ease),
    width 0.4s var(--side-ease),
    min-width 0.4s var(--side-ease),
    padding 0.36s var(--side-ease),
    margin 0.36s var(--side-ease),
    opacity 0.26s ease 0.05s,
    border-color 0.22s ease,
    box-shadow 0.4s var(--side-ease);
}
#rightPanel .panel-fold-body {
  min-width: min(300px, 36vw);
  width: max-content;
  max-width: min(460px, 48vw);
  transition:
    opacity 0.3s ease 0.08s,
    transform 0.4s var(--side-ease);
  transform: translateX(0);
  opacity: 1;
}
#rightPanel:not(.is-folded) .panel-fold-body > * {
  animation: drop-child-in 0.34s var(--side-ease) both;
}
#rightPanel:not(.is-folded) .panel-fold-body > .panel-head { animation-delay: 0.04s; }
#rightPanel:not(.is-folded) .panel-fold-body > .board { animation-delay: 0.09s; }
#rightPanel:not(.is-folded) .panel-fold-body > .panel-hint { animation-delay: 0.13s; }
@keyframes drop-child-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Fully collapsed — zero UI */
.panel.is-folded {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border-width: 0 !important;
  border-color: transparent !important;
  box-shadow: none !important;
  opacity: 0 !important;
  overflow: hidden;
  pointer-events: none;
  flex: 0 0 0 !important;
}
/* Loadout hide: content slides left first, then panel shrinks sideways */
#equipPanel.is-folded {
  transition:
    max-width 0.48s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.48s cubic-bezier(0.4, 0, 0.2, 1),
    min-width 0.48s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    margin 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.32s ease,
    border-width 0.28s ease,
    box-shadow 0.35s ease;
}
/* Drop zone: slower, softer hide */
#rightPanel.is-folded {
  transition:
    max-width 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    min-width 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.48s cubic-bezier(0.4, 0, 0.2, 1),
    margin 0.48s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.42s ease,
    border-width 0.35s ease,
    box-shadow 0.4s ease;
}
#equipPanel.is-folded .panel-fold-body {
  opacity: 0;
  transform: translateX(-22px);
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.36s cubic-bezier(0.4, 0, 0.2, 1);
}
#equipPanel.is-folded .panel-fold-body > * {
  animation: none !important;
}
#rightPanel.is-folded .panel-fold-body {
  opacity: 0;
  transform: translateX(18px);
  pointer-events: none;
  /* Content fades out first, then panel shrinks */
  transition:
    opacity 0.28s ease,
    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
#rightPanel.is-folded .panel-fold-body > * {
  animation: none !important;
}
/* Sideways expand glow (loadout + drop) */
#equipPanel.is-fold-anim:not(.is-folded),
#rightPanel.is-fold-anim:not(.is-folded) {
  animation: side-expand-glow 0.48s var(--side-ease, cubic-bezier(0.22, 1, 0.36, 1));
}
@keyframes side-expand-glow {
  0% {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  }
  40% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--inv-accent, #6ea8ff) 22%, transparent),
      0 10px 28px rgba(0, 0, 0, 0.38);
  }
  100% {
    box-shadow: 0 calc(12px * var(--inv-shadow, 1)) calc(36px * var(--inv-shadow, 1)) rgba(0, 0, 0, calc(0.45 * var(--inv-shadow, 1)));
  }
}
/* legacy name kept for any external refs */
@keyframes drop-expand-glow {
  0% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32); }
  40% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--inv-accent, #6ea8ff) 22%, transparent),
      0 10px 28px rgba(0, 0, 0, 0.38);
  }
  100% {
    box-shadow: 0 calc(12px * var(--inv-shadow, 1)) calc(36px * var(--inv-shadow, 1)) rgba(0, 0, 0, calc(0.45 * var(--inv-shadow, 1)));
  }
}
/* —— Equip column —— */
.equip {
  flex: 0 0 auto;
  align-items: stretch;
}
.equip .kicker { margin-bottom: 2px; }
.equip h2 {
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.equip-slots,
#equipSlots {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  padding-right: 0;
}
.equip-slots::-webkit-scrollbar,
#equipSlots::-webkit-scrollbar { width: 4px; }
.equip-slots::-webkit-scrollbar-thumb,
#equipSlots::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.secondary { flex: 0 1 auto; }

.kicker {
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--inv-kicker, #6ea8ff);
  margin-bottom: 2px;
  transition: color 0.15s ease;
}
/* Right-panel context kicker colors */
.kicker.ctx-drop,
.kicker.ctx-newdrop { color: #9aa3b2; }
.kicker.ctx-stash { color: #f0b429; }
.kicker.ctx-trunk { color: #38bdf8; }
.kicker.ctx-glovebox { color: #67e8f9; }
.kicker.ctx-engine { color: #fb923c; }
.kicker.ctx-shop { color: #4ade80; }

#rightPanel[data-type="engine"] {
  border-color: rgba(251, 146, 60, 0.28);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(251, 146, 60, 0.08);
  min-width: 340px;
}

/* Engine bay: dedicated car-part sockets */
#rightBoard.engine-bay,
.board.engine-bay {
  display: grid !important;
  grid-template-columns: minmax(84px, 1fr) minmax(120px, 1.35fr) minmax(84px, 1fr);
  grid-template-rows: 78px 96px 78px 78px;
  grid-template-areas:
    "radiator radiator radiator"
    "battery  block    alt"
    "timing   block    spark"
    "oil      air      spark";
  gap: 8px;
  padding: 6px 2px 2px;
  width: 100%;
  min-height: 340px;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(251, 146, 60, 0.07), transparent 62%),
    rgba(0, 0, 0, 0.18);
  border-radius: 12px;
}
.eng-slot {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  min-height: 0;
}
.eng-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fdba74;
  opacity: 0.85;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eng-slot.is-critical .eng-label { color: #fbbf24; }
.eng-frame {
  flex: 1;
  position: relative;
  min-height: 0;
  border-radius: 10px;
  border: 1px dashed rgba(251, 146, 60, 0.38);
  background: rgba(8, 10, 14, 0.55);
  overflow: hidden;
}
.eng-slot.is-filled .eng-frame {
  border-style: solid;
  border-color: rgba(251, 146, 60, 0.62);
  box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.12);
}
.eng-slot.is-empty .eng-frame {
  background-image: repeating-linear-gradient(
    -32deg,
    transparent 0 7px,
    rgba(251, 146, 60, 0.04) 7px 8px
  );
}
.eng-ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(253, 186, 116, 0.35);
  pointer-events: none;
  text-align: center;
  padding: 4px;
}
.eng-frame .item {
  position: absolute !important;
  inset: 4px;
  width: auto !important;
  height: auto !important;
  grid-column: auto !important;
  grid-row: auto !important;
  border-radius: 8px;
}
.eng-dur {
  position: absolute;
  right: 3px;
  top: 3px;
  z-index: 4;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #e8ecf4;
  pointer-events: none;
}
.eng-slot.drag-over .eng-frame,
.eng-frame.drag-over {
  outline: 1px solid rgba(251, 146, 60, 0.9);
  outline-offset: 1px;
  border-color: #fb923c;
}

#rightPanel[data-type="stash"] {
  border-color: rgba(240, 180, 41, 0.22);
}

/* ── DU_Drug_System safehouse locker skin ───────────────────────── */
#app.skin-drug-locker .inv-wrap {
  gap: 18px;
}
#app.skin-drug-locker .panel {
  background: linear-gradient(165deg, rgba(14, 22, 18, 0.98), rgba(8, 12, 10, 0.98));
  border-color: rgba(74, 222, 128, 0.18);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(74, 222, 128, 0.06);
}
#app.skin-drug-locker .equip {
  border-color: rgba(74, 222, 128, 0.14);
}
#app.skin-drug-locker .kicker,
#app.skin-drug-locker .kicker.ctx-drug-player {
  color: #4ade80 !important;
  letter-spacing: 0.16em;
}
#app.skin-drug-locker .kicker.ctx-drug_locker,
#app.skin-drug-locker .kicker.ctx-stash {
  color: #86efac !important;
}
#app.skin-drug-locker .panel h2 {
  color: #e8f5e9;
}
#app.skin-drug-locker .badge.accent {
  border-color: rgba(74, 222, 128, 0.35);
  color: #bbf7d0;
}
#app.skin-drug-locker .cell.main {
  background: rgba(34, 80, 50, 0.12);
  border-color: rgba(74, 222, 128, 0.14);
}
#app.skin-drug-locker .cell.backpack {
  background: rgba(60, 40, 90, 0.16);
  border-color: rgba(167, 139, 250, 0.22);
}
#app.skin-drug-locker .cell.drag-over,
#app.skin-drug-locker .cell.drag-over-foot,
#app.skin-drug-locker .cell.drag-over-origin {
  outline-color: rgba(74, 222, 128, 0.85);
}
#app.skin-drug-locker #rightPanel[data-type="drug_locker"],
#app.skin-drug-locker #rightPanel[data-type="stash"] {
  border-color: rgba(74, 222, 128, 0.35);
  background: linear-gradient(180deg, rgba(12, 28, 18, 0.98), rgba(8, 16, 12, 0.98));
}
#app.skin-drug-locker #rightPanel .board {
  border-color: rgba(74, 222, 128, 0.12);
  background: rgba(4, 12, 8, 0.55);
}
#app.skin-drug-locker .panel-hint {
  color: #86efac !important;
  opacity: 0.9;
}
#app.skin-drug-locker .btn.primary {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  border-color: rgba(187, 247, 208, 0.25);
}
#app.skin-drug-locker .equip-frame.backpack {
  border-color: rgba(167, 139, 250, 0.4);
}
#app.skin-drug-locker .zone-div {
  color: rgba(167, 139, 250, 0.85);
}
#rightPanel[data-type="trunk"] {
  border-color: rgba(56, 189, 248, 0.22);
}
#rightPanel[data-type="glovebox"] {
  border-color: rgba(103, 232, 249, 0.2);
}
#rightPanel[data-type="shop"] {
  border-color: rgba(74, 222, 128, 0.25);
}
#rightPanel[data-type="drop"],
#rightPanel[data-type="newdrop"] {
  border-color: rgba(154, 163, 178, 0.18);
}

h2 { margin: 0; font-size: 15px; font-weight: 750; color: #f2f4f8; line-height: 1.25; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-content: flex-start;
  padding-top: 2px;
}
.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--inv-badge-bg, rgba(255, 255, 255, 0.06));
  color: var(--inv-text-muted, #8b93a7);
  line-height: 1.3;
  white-space: nowrap;
}
.badge.accent {
  border-color: color-mix(in srgb, var(--inv-accent, #6ea8ff) 40%, transparent);
  background: color-mix(in srgb, var(--inv-accent, #6ea8ff) 16%, transparent);
  color: var(--inv-accent, #6ea8ff);
}

/* Slim player status — health / food / thirst */
.vitals {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: -2px 0 10px;
  flex-shrink: 0;
}
.vital {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.vital-lab {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--inv-text-muted, #8b93a7);
  line-height: 1;
}
.vital-n {
  font-size: 10px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: #c9d0dc;
  min-width: 1.6em;
  text-align: right;
  line-height: 1;
}
.vital-track {
  display: block;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  min-width: 0;
}
.vital-track i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transform-origin: left center;
  transition: width 0.28s ease;
}
.vital[data-k="health"] .vital-track i { background: #e07070; }
.vital[data-k="armor"] .vital-track i { background: #9bb6c9; }
.vital[data-k="hunger"] .vital-track i { background: #e0a040; }
.vital[data-k="thirst"] .vital-track i { background: #6ea8ff; }
.vital[data-k="armor"].hidden { display: none !important; }
.vital.is-low .vital-n { color: #ff8a8a; }
.vital.is-low .vital-lab { color: #c98a8a; }
.vital.is-low .vital-track i { box-shadow: 0 0 8px rgba(255, 90, 90, 0.35); }

/* Persistent 3D need HUD — recedes into the right corner */
.need-hud {
  position: fixed;
  right: 16px;
  bottom: 42px;
  z-index: 8;
  pointer-events: none;
  perspective: 820px;
  perspective-origin: 104% 88%;
}
.need-hud.hidden { display: none !important; }
.need-hud.is-edit {
  display: block !important;
  pointer-events: none;
  z-index: 100010;
  perspective: none;
}
/* Placed pieces must not live inside the 3D stack — CEF treats fixed as
   absolute to the transformed parent and parks them off-screen (bottom-left). */
.need-hud.is-edit,
.need-hud.is-free {
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  perspective: none;
}
.need-hud.is-edit .need-stack,
.need-hud.is-free .need-stack {
  transform: none !important;
  transform-style: flat;
  width: 100%;
  height: 100%;
}
.need-hud.is-edit .need-wep,
.need-hud.is-free .need-wep {
  transform: none;
}
.need-hud.is-edit [data-hud] {
  position: relative;
  cursor: grab;
  outline: 1px dashed rgba(255, 255, 255, 0.38);
  outline-offset: 6px;
  pointer-events: auto;
  transform: scale(var(--hud-s, 1));
  transform-origin: top left;
  overflow: visible;
}
.need-hud.is-edit [data-hud]::before {
  content: "";
  position: absolute;
  inset: -14px;
  z-index: 0;
}
.need-hud.is-edit [data-hud].is-dragging {
  cursor: grabbing;
  outline-color: var(--need-slot, #ffd56a);
  transition: none !important;
}
.need-hud:not(.is-edit) [data-hud].is-hud-off {
  display: none !important;
}
.need-hud.is-edit [data-hud].is-hud-off {
  opacity: 0.4;
  filter: grayscale(0.4);
}
.hud-chip {
  display: none;
}
.need-hud.is-edit .hud-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  left: 0;
  top: -30px;
  z-index: 21;
  pointer-events: auto;
}
.hud-chip-pct {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #f4f7fb;
  background: rgba(8, 10, 14, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
}
.hud-eye {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  background: rgba(8, 10, 14, 0.72);
  color: #f4f7fb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hud-eye svg {
  width: 14px;
  height: 14px;
  display: block;
}
.hud-eye .eye-off { display: none; }
.hud-eye.is-off {
  color: #ffb4b4;
  border-color: rgba(255, 140, 140, 0.35);
}
.hud-eye.is-off .eye-on { display: none; }
.hud-eye.is-off .eye-off { display: block; }
.hud-eye:hover {
  background: rgba(20, 24, 32, 0.92);
  border-color: rgba(255, 255, 255, 0.32);
}
.need-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: rotateY(var(--need-ry, -26deg)) rotateX(var(--need-rx, 11deg)) translateZ(0);
  transform-origin: 100% 100%;
  transform-style: preserve-3d;
}
.need-hud [data-hud].is-placed {
  position: absolute;
  margin: 0;
  z-index: 9;
  transform: scale(var(--hud-s, 1));
  transform-origin: top left;
}
.need-hotbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-right: 2px;
  margin-bottom: 2px;
  transform-style: preserve-3d;
  pointer-events: none;
}
.need-wep {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 11px;
  background:
    linear-gradient(160deg, var(--inv-item-bg, rgba(255, 255, 255, 0.2)), rgba(8, 10, 14, 0.72));
  border: 1.5px solid var(--inv-item-border, rgba(255, 255, 255, 0.38));
  box-shadow:
    0 12px 22px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transform: translateZ(18px);
  overflow: hidden;
}
.need-wep em {
  position: absolute;
  left: 6px;
  top: 4px;
  z-index: 2;
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #f4f7fb;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}
.need-wep-art {
  display: block;
  position: absolute;
  inset: 10px 7px 7px;
  background: center / contain no-repeat;
  opacity: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
}
.need-wep[data-k="taser"].hidden {
  display: none !important;
}
.need-wep[data-k="taser"] {
  border-color: rgba(255, 213, 106, 0.45);
}
.equip-frame.taser {
  box-shadow: inset 0 0 0 1px rgba(255, 213, 106, 0.28);
}
.need-wep.is-empty {
  opacity: 0.7;
}
.need-wep.is-empty .need-wep-art { background-image: none !important; }
.need-wep.is-on {
  overflow: visible;
  z-index: 2;
  border-color: var(--need-slot, #ffd56a);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--need-slot, #ffe08a) 58%, #1a1408), rgba(28, 18, 6, 0.9));
  box-shadow:
    0 0 0 2px var(--need-slot, #ffd56a),
    0 0 16px color-mix(in srgb, var(--need-slot, #ffc440) 75%, transparent),
    0 0 34px color-mix(in srgb, var(--need-slot, #e8a020) 40%, transparent),
    inset 0 1px 0 rgba(255, 240, 180, 0.55);
  animation: needOnGlow 1.8s ease-in-out infinite;
}
.need-wep.is-on em {
  color: #1a1408;
  background: var(--need-slot, #ffd56a);
  border-radius: 4px;
  padding: 1px 5px;
  left: 4px;
  top: 4px;
  text-shadow: none;
}
.need-wep.is-on .need-wep-art {
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--need-slot, #ffd56a) 65%, transparent));
}
@keyframes needOnGlow {
  0%, 100% {
    box-shadow:
      0 0 0 2px var(--need-slot, #ffd56a),
      0 0 12px color-mix(in srgb, var(--need-slot, #ffc440) 55%, transparent),
      0 0 22px color-mix(in srgb, var(--need-slot, #e8a020) 28%, transparent),
      inset 0 1px 0 rgba(255, 240, 180, 0.5);
  }
  50% {
    box-shadow:
      0 0 0 2px #fff3c4,
      0 0 22px color-mix(in srgb, var(--need-slot, #ffc440) 90%, transparent),
      0 0 40px color-mix(in srgb, var(--need-slot, #e8a020) 50%, transparent),
      inset 0 1px 0 rgba(255, 250, 210, 0.7);
  }
}

.need-rail {
  display: flex;
  align-items: center;
  gap: 12px;
  transform-style: preserve-3d;
}
.need-lab {
  flex: 0 0 auto;
  min-width: 52px;
  text-align: left;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #f3f6fb;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.9),
    0 0 10px rgba(0, 0, 0, 0.55);
  transform: translateZ(16px);
}
.need-rail[data-k="health"] .need-lab { color: var(--need-health, #ff8b8b); }
.need-rail[data-k="armor"] .need-lab { color: var(--need-armor, #c5d6e4); }
.need-rail[data-k="hunger"] .need-lab { color: var(--need-hunger, #ffd56a); }
.need-rail[data-k="thirst"] .need-lab { color: var(--need-thirst, #9fd4ff); }
.need-rail[data-k="armor"].hidden { display: none !important; }
.need-beam {
  position: relative;
  width: 268px;
  height: 22px;
  transform-style: preserve-3d;
}
.need-track {
  position: absolute;
  inset: 0;
  border-radius: 3px 7px 3px 2px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02) 72%, rgba(0, 0, 0, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateZ(0);
}
.need-beam::after {
  content: "";
  position: absolute;
  right: -10px;
  top: 3px;
  width: 12px;
  height: 18px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.5));
  border-radius: 0 4px 4px 0;
  transform: rotateY(62deg);
  transform-origin: left center;
}
.need-fill {
  position: absolute;
  left: 2px;
  top: 2px;
  bottom: 2px;
  width: calc((100% - 4px) * var(--p, 1));
  border-radius: 2px 5px 2px 1px;
  transform: translateZ(5px);
  transform-origin: left center;
  transition: width 0.35s ease, filter 0.25s ease;
}
.need-rail[data-k="health"] .need-fill {
  background: linear-gradient(90deg, var(--need-health, #ff8b8b), #d44545 78%, #8a1e1e);
  box-shadow: 0 0 10px color-mix(in srgb, var(--need-health, #e05050) 28%, transparent);
}
.need-rail[data-k="armor"] .need-fill {
  background: linear-gradient(90deg, var(--need-armor, #d4e4f0), #7e9bb0 78%, #3d5363);
  box-shadow: 0 0 10px color-mix(in srgb, var(--need-armor, #9bb6c9) 28%, transparent);
}
.need-rail[data-k="hunger"] .need-fill {
  background: linear-gradient(90deg, var(--need-hunger, #f3c45a), #c48412 78%, #8a5a08);
  box-shadow: 0 0 10px color-mix(in srgb, var(--need-hunger, #e8a020) 28%, transparent);
}
.need-rail[data-k="thirst"] .need-fill {
  background: linear-gradient(90deg, var(--need-thirst, #8ec5ff), #3d7fd4 78%, #1e4e8c);
  box-shadow: 0 0 10px color-mix(in srgb, var(--need-thirst, #5096ff) 26%, transparent);
}
.need-rail.is-low .need-fill { filter: saturate(1.15) brightness(1.08); }
.need-rail.is-low .need-lab { color: #ff9b9b; }
.need-cap {
  display: none;
}

@media (max-width: 1100px) {
  .need-hud { right: 10px; bottom: 28px; }
  .need-beam { width: 210px; height: 18px; }
  .need-lab { font-size: 12px; min-width: 44px; }
  .need-wep { width: 52px; height: 52px; }
}

.panel.bag .panel-head.bag-head {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.bag-head-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.ghost-row {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 3px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.055);
}
.ghost-split {
  width: 1px;
  height: 12px;
  margin: 0 3px;
  background: rgba(255, 255, 255, 0.12);
  flex: 0 0 1px;
}
.craft-ghost {
  flex: 1 1 0;
  display: block;
  margin: 0;
  padding: 6px 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--inv-ghost, rgba(232, 208, 138, 0.42));
  font: 650 10px/1 inherit;
  letter-spacing: 0.06em;
  text-transform: none;
  text-align: center;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.craft-ghost:hover {
  color: var(--inv-ghost-hover, rgba(232, 208, 138, 0.88));
  background: rgba(255, 255, 255, 0.04);
}
.craft-ghost.is-ghost-on {
  color: var(--inv-accent, #e8d08a);
  background: color-mix(in srgb, var(--inv-accent, #e8d08a) 16%, transparent);
}
.craft-ghost.is-press {
  color: var(--inv-accent, #e8d08a);
}

.craft-pop {
  position: relative;
  width: min(360px, 32vw);
  height: auto;
  max-height: none;
  z-index: 6;
  display: flex;
  flex-direction: column;
  padding: var(--panel-pad);
  border-radius: var(--inv-radius, 14px);
  background: var(--inv-panel-bg, rgba(12, 14, 20, 0.97));
  border: 1px solid var(--inv-panel-border, rgba(255, 255, 255, 0.09));
  box-shadow: 0 calc(12px * var(--inv-shadow, 1)) calc(36px * var(--inv-shadow, 1)) rgba(0, 0, 0, calc(0.45 * var(--inv-shadow, 1)));
  pointer-events: auto;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.craft-pop.hidden { display: none !important; }
.wear-pop {
  position: relative;
  width: calc(var(--equip-frame) + 36px);
  min-width: calc(var(--equip-frame) + 28px);
  display: flex;
  flex-direction: column;
  padding: var(--panel-pad);
  border-radius: var(--inv-radius, 14px);
  background: var(--inv-panel-bg, rgba(12, 14, 20, 0.97));
  border: 1px solid var(--inv-panel-border, rgba(255, 255, 255, 0.09));
  box-shadow: 0 calc(12px * var(--inv-shadow, 1)) calc(36px * var(--inv-shadow, 1)) rgba(0, 0, 0, calc(0.45 * var(--inv-shadow, 1)));
  pointer-events: auto;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.wear-pop.hidden { display: none !important; }
.wear-slots {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.wear-slots::-webkit-scrollbar { width: 6px; }
.wear-slots::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.wear-slots::-webkit-scrollbar-track { background: transparent; }
.craft-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.craft-head .kicker {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: var(--inv-kicker, #e8a020);
}
.craft-head h2 {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 750;
}
.craft-cats {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.craft-cat {
  border: 1px solid rgba(232, 160, 32, 0.28);
  background: rgba(232, 160, 32, 0.1);
  color: #f0d08a;
  border-radius: 999px;
  padding: 5px 10px;
  font: 700 11px inherit;
  cursor: pointer;
}
.craft-cat.is-on {
  background: #e8a020;
  color: #1a1306;
  border-color: #e8a020;
}
.craft-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(6, 8, 12, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.craft-list::-webkit-scrollbar { width: 6px; height: 6px; }
.craft-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.craft-list::-webkit-scrollbar-track { background: transparent; }
.craft-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}
.craft-card.is-off { opacity: 0.55; }
.craft-art {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35) center / 72% no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.craft-card h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}
.craft-card p {
  margin: 3px 0 0;
  font-size: 11px;
  color: #9aa3b5;
  line-height: 1.35;
}
.craft-need {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.craft-need i {
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: #c9d0dc;
}
.craft-need i.ok { color: #7dcea0; }
.craft-need i.bad { color: #f07178; }
.craft-need i.tool { color: #8ec5ff; }
.craft-make {
  position: relative;
  border: 0;
  border-radius: 9px;
  width: auto;
  height: 34px;
  min-width: 52px;
  padding: 0 12px;
  background: linear-gradient(180deg, #f0b84a, #d49216);
  color: #1a1306;
  font: 800 12px inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: width 0.22s cubic-bezier(0.22, 1, 0.36, 1), min-width 0.22s ease, border-radius 0.22s ease, padding 0.22s ease;
}
.craft-make .craft-make-lab { pointer-events: none; }
.craft-make .craft-ring {
  display: none;
  position: absolute;
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  transform: rotate(-90deg);
}
.craft-ring-track {
  fill: none;
  stroke: rgba(26, 19, 6, 0.22);
  stroke-width: 3.2;
}
.craft-ring-fill {
  fill: none;
  stroke: #1a1306;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-dasharray: 94.2;
  stroke-dashoffset: 94.2;
}
.craft-make.is-busy {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
}
.craft-make.is-busy .craft-make-lab { display: none; }
.craft-make.is-busy .craft-ring { display: block; }
.craft-make:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
.craft-make.is-busy:disabled {
  opacity: 1;
  filter: none;
  cursor: wait;
}
.craft-empty {
  margin: 12px 4px;
  color: #8b93a7;
  font-size: 13px;
}

/* —— Inventory grids (left + right share --cell / --gap) —— */
.board {
  display: grid;
  gap: var(--gap);
  padding: 8px;
  border-radius: 12px;
  background: rgba(6, 8, 12, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  width: fit-content;
  max-width: 100%;
  max-height: min(68vh, 720px);
  overflow: auto;
  position: relative;
  box-sizing: border-box;
  flex: 0 1 auto;
  align-content: start;
  justify-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.board::-webkit-scrollbar { width: 6px; height: 6px; }
.board::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.board::-webkit-scrollbar-track { background: transparent; }

.cell {
  width: var(--cell);
  height: var(--cell);
  min-width: var(--cell);
  min-height: var(--cell);
  border-radius: 8px;
  border: 1px solid var(--inv-slot-border, rgba(255, 255, 255, 0.04));
  background: var(--inv-slot-bg, rgba(255, 255, 255, 0.028));
  position: relative;
  box-sizing: border-box;
}
.cell.main {
  background: var(--inv-zone-main, rgba(90, 140, 210, 0.07));
  border-color: var(--inv-zone-main-border, rgba(110, 168, 255, 0.16));
}
.cell.backpack {
  background: var(--inv-zone-bag, rgba(160, 90, 230, 0.1));
  border-color: var(--inv-zone-bag-border, rgba(181, 107, 255, 0.28));
}
.cell.locked {
  background: rgba(18, 16, 22, 0.55) !important;
  border-color: rgba(255, 70, 70, 0.22) !important;
  opacity: 0.9;
}
.cell.locked::after {
  content: '×';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 72, 72, 0.85);
  font-weight: 800;
  font-size: calc(var(--cell) * 0.32);
}
/* Placement preview — soft transitions so footprint doesn't "pop" */
.cell {
  transition: outline-color 0.12s ease, outline-width 0.12s ease, background-color 0.12s ease;
}
.cell.drag-over,
.cell.drag-over-foot {
  outline: 1px solid color-mix(in srgb, var(--inv-accent, #6ea8ff) 75%, transparent);
  outline-offset: -1px;
  z-index: 3;
}
.cell.drag-over-origin {
  outline: 2px solid var(--inv-accent, #6ea8ff);
  outline-offset: -1px;
}
/* Valid / invalid footprint */
.cell.drag-valid,
.cell.drag-valid-foot {
  outline: 1px solid var(--inv-valid, rgba(72, 210, 130, 0.9));
  outline-offset: -1px;
  z-index: 3;
  background: color-mix(in srgb, var(--inv-valid, #48d282) 12%, transparent) !important;
}
.cell.drag-valid.drag-over-origin {
  outline: 2px solid var(--inv-valid, rgba(72, 210, 130, 0.95));
}
.cell.drag-invalid,
.cell.drag-invalid-foot {
  outline: 1px solid var(--inv-invalid, rgba(255, 88, 88, 0.9));
  outline-offset: -1px;
  z-index: 3;
  background: color-mix(in srgb, var(--inv-invalid, #ff5858) 12%, transparent) !important;
}
.cell.drag-invalid.drag-over-origin {
  outline: 2px solid var(--inv-invalid, rgba(255, 88, 88, 0.95));
}
.equip-frame {
  transition: outline-color 0.12s ease, box-shadow 0.12s ease;
  background: var(--inv-equip-zone, rgba(0, 0, 0, 0.35));
  border-radius: calc(var(--inv-radius, 14px) * 0.7);
}
.equip-frame.drag-valid {
  outline: 2px solid var(--inv-valid, rgba(72, 210, 130, 0.9));
  outline-offset: -2px;
}
.equip-frame.drag-invalid {
  outline: 2px solid var(--inv-invalid, rgba(255, 88, 88, 0.9));
  outline-offset: -2px;
}
.item.is-selected {
  box-shadow: 0 0 0 2px rgba(110, 168, 255, 0.85), 0 2px 10px rgba(0, 0, 0, 0.45);
  border-color: rgba(110, 168, 255, 0.65);
}
.rotate-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #0b1220;
  background: linear-gradient(180deg, #8ec5ff, #6ea8ff);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 4px 12px rgba(80, 140, 255, 0.35);
  margin-left: 0;
  flex-shrink: 0;
}
.rotate-badge.hidden { display: none !important; }
.inv-toast {
  position: fixed;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  z-index: 99999;
  min-width: 180px;
  max-width: min(420px, 90vw);
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(12, 16, 24, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f2f5fa;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.inv-toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  pointer-events: none;
}
.inv-toast.is-error {
  border-color: rgba(255, 100, 100, 0.45);
  color: #ffd0d0;
}
.inv-toast.is-ok {
  border-color: rgba(90, 220, 140, 0.4);
  color: #d4ffe4;
}
.drag-ghost.is-aligned {
  /* kept for compatibility — we no longer hard-snap to cells */
  opacity: 0.92;
}
.drag-ghost.is-invalid {
  border-color: rgba(255, 100, 100, 0.65);
  box-shadow: 0 8px 22px rgba(255, 60, 60, 0.22);
  opacity: 0.88;
}

/* Items as grid children — fill spanned tracks (gap included by grid) */
.item {
  position: relative;
  border-radius: calc(var(--inv-radius, 14px) * 0.55);
  border: 1px solid var(--inv-item-border, rgba(255, 255, 255, 0.12));
  background: var(--inv-item-bg, rgba(16, 18, 26, 0.85)) center / 76% no-repeat;
  box-shadow: 0 2px 8px rgba(0, 0, 0, calc(0.35 * var(--inv-shadow, 1)));
  z-index: 2;
  cursor: grab;
  box-sizing: border-box;
  overflow: hidden;
  touch-action: none;
  -webkit-user-drag: none;
  user-select: none;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  justify-self: stretch;
  width: auto !important;
  height: auto !important;
}
.board > .item {
  /* Explicit fill of multi-cell area when span is set */
  width: 100% !important;
  height: 100% !important;
  z-index: 4;
}
.item:active { cursor: grabbing; }
.item.is-locked {
  cursor: not-allowed;
  filter: grayscale(1) brightness(0.52);
  border: 2px solid #e23a3a;
  box-shadow:
    inset 0 0 0 1px rgba(226, 58, 58, 0.45),
    0 0 0 1px rgba(226, 58, 58, 0.55);
}
.item.is-locked::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -32deg,
    transparent 0 7px,
    rgba(226, 58, 58, 0.42) 7px 10px
  );
  pointer-events: none;
  z-index: 3;
}
.item.is-locked .lock-seal,
.item.is-locked .price,
.item.is-locked .count,
.item.is-locked .label,
.item.is-locked .rarity-tag {
  display: none !important;
}
#app.is-shop[data-skin="police_armory"] #rightPanel {
  border-color: rgba(232, 160, 32, 0.28);
}
#app.is-shop[data-skin="police_armory"] #rightKicker {
  color: #e8a020;
}
/* While dragging: peers ignore hits (no per-item class thrash / blink) */
#app.dragging .board > .item {
  pointer-events: none !important;
}
#app.dragging .item.is-dragging-source {
  opacity: 0.28;
  transition: opacity 0.14s ease;
}
.item .count {
  position: absolute;
  top: 3px;
  right: 3px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 4px;
  padding: 1px 4px;
  line-height: 1.2;
  z-index: 3;
}
/* Rarity tag (UNC / RARE / EPIC / LEG) — bottom-left */
.item .rarity-tag {
  position: absolute;
  left: 3px;
  bottom: 3px;
  z-index: 4;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  pointer-events: none;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e8ecf4;
}
.item.has-rarity.rarity-uncommon .rarity-tag {
  color: #86efac;
  border-color: rgba(50, 220, 120, 0.55);
  background: rgba(10, 40, 24, 0.88);
  box-shadow: 0 0 8px rgba(40, 200, 110, 0.35);
}
.item.has-rarity.rarity-rare .rarity-tag {
  color: #93c5fd;
  border-color: rgba(70, 150, 255, 0.6);
  background: rgba(10, 24, 48, 0.9);
  box-shadow: 0 0 8px rgba(60, 140, 255, 0.4);
}
.item.has-rarity.rarity-epic .rarity-tag {
  color: #e9d5ff;
  border-color: rgba(190, 90, 255, 0.65);
  background: rgba(30, 12, 48, 0.92);
  box-shadow: 0 0 10px rgba(180, 80, 255, 0.45);
}
.item.has-rarity.rarity-legendary .rarity-tag {
  color: #fde68a;
  border-color: rgba(255, 200, 50, 0.7);
  background: rgba(40, 28, 8, 0.92);
  box-shadow: 0 0 10px rgba(255, 190, 40, 0.5);
}
/* Left rarity strip */
.item.has-rarity::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  z-index: 3;
  pointer-events: none;
  border-radius: 2px 0 0 2px;
  background: rgba(160, 170, 185, 0.55);
}
.item.has-rarity.rarity-uncommon::before {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  box-shadow: 0 0 8px rgba(50, 220, 120, 0.55);
}
.item.has-rarity.rarity-rare::before {
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  box-shadow: 0 0 8px rgba(70, 150, 255, 0.55);
}
.item.has-rarity.rarity-epic::before {
  background: linear-gradient(180deg, #c084fc, #9333ea);
  box-shadow: 0 0 10px rgba(190, 90, 255, 0.6);
}
.item.has-rarity.rarity-legendary::before {
  background: linear-gradient(180deg, #fbbf24, #d97706);
  box-shadow: 0 0 10px rgba(255, 200, 50, 0.65);
}
.item .label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: 8px;
  font-weight: 650;
  text-align: center;
  padding: 2px 3px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.item .price {
  position: absolute;
  top: 3px;
  left: 3px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #bbf7d0;
  background: linear-gradient(135deg, rgba(22, 101, 52, 0.92), rgba(21, 128, 61, 0.88));
  border: 1px solid rgba(74, 222, 128, 0.45);
  border-radius: 5px;
  padding: 1px 5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  line-height: 1.25;
  max-width: calc(100% - 6px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 3;
}
.item.has-price .count {
  top: auto;
  bottom: 3px;
  right: 3px;
}
.item.no-image {
  background-color: rgba(24, 28, 38, 0.92);
}

/* Engine-part durability bar (bottom edge of cell) */
.item .durability {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 3px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.55);
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}
.item.has-durability .label {
  bottom: 6px;
}
.item .durability > i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: #4ade80;
}
.item .durability.dur-ok > i { background: linear-gradient(90deg, #22c55e, #4ade80); }
.item .durability.dur-warn > i { background: linear-gradient(90deg, #d97706, #fbbf24); }
.item .durability.dur-bad > i { background: linear-gradient(90deg, #b91c1c, #f87171); }
.item.is-broken {
  filter: saturate(0.45) brightness(0.78);
}
.item.is-broken::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -32deg,
    transparent 0 8px,
    rgba(248, 113, 113, 0.18) 8px 11px
  );
  pointer-events: none;
  z-index: 3;
}

/* —— Equipment frames —— */
.equip-slot {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.equip-slot span {
  display: block;
  width: 100%;
  font-size: 10px;
  font-weight: 700;
  margin: 0;
  opacity: 0.8;
  text-align: center;
  letter-spacing: 0.02em;
}
.equip-frame {
  width: var(--equip-frame);
  height: var(--equip-frame);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  flex-shrink: 0;
  /* Larger hit target for multi-cell items (backpack 2×2) */
  cursor: pointer;
}
.equip-frame.backpack {
  border-color: rgba(181, 107, 255, 0.28);
  box-shadow: inset 0 0 0 1px rgba(181, 107, 255, 0.12);
}
.equip-frame.filled { border-color: rgba(110, 168, 255, 0.4); }
.equip-frame.backpack.filled { border-color: rgba(181, 107, 255, 0.45); }
.equip-frame.armor.filled { border-color: rgba(148, 163, 184, 0.5); }
.equip-frame.clothing {
  border-color: rgba(232, 160, 32, 0.28);
  box-shadow: inset 0 0 0 1px rgba(232, 160, 32, 0.1);
}
.equip-frame.clothing.filled { border-color: rgba(232, 160, 32, 0.55); }
.equip-frame.helmet {
  border-color: rgba(200, 210, 220, 0.28);
  box-shadow: inset 0 0 0 1px rgba(200, 210, 220, 0.1);
}
.equip-frame.helmet.filled { border-color: rgba(200, 210, 220, 0.55); }
.equip-frame.drag-over {
  outline: 1px solid rgba(110, 168, 255, 0.85);
  outline-offset: 1px;
}
.equip-slot {
  /* expand drop magnet around each frame */
  padding: 2px 0;
}
.equip-frame .item {
  position: absolute !important;
  inset: 3px;
  width: auto !important;
  height: auto !important;
  border-radius: 7px;
}

/* —— Controls toolbar (player bag footer) —— */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 0;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.controls-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.controls-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.amount-input,
#amount.amount-input,
#amount {
  width: 44px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 10, 14, 0.9);
  color: #fff;
  padding: 0 4px;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  box-sizing: border-box;
  flex-shrink: 0;
}
.amount-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
}
/* legacy (unused) */
.amount { display: none; }

.btn {
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--inv-btn-bg, rgba(255, 255, 255, 0.06));
  color: var(--inv-text, #e8ecf4);
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex-shrink: 0;
}
.btn:hover { filter: brightness(1.1); }
.btn.primary {
  border: none;
  background: var(--inv-btn-primary, linear-gradient(180deg, #8bbcff, #6ea8ff));
  color: #0b1020;
}
.btn.icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  margin-left: 0;
  font-size: 13px;
}
.controls-tools .btn.icon {
  opacity: 0.85;
}
.controls-tools .btn.icon:hover {
  opacity: 1;
}
#btnTheme .ico-settings {
  display: block;
  width: 15px;
  height: 15px;
}
#btnTheme.is-ghost-on {
  color: var(--inv-accent, #e8d08a);
  border-color: color-mix(in srgb, var(--inv-accent, #e8d08a) 40%, transparent);
  background: color-mix(in srgb, var(--inv-accent, #e8d08a) 16%, transparent);
}
.hint {
  margin: 6px 0 0;
  font-size: 9px;
  opacity: 0.4;
  flex-shrink: 0;
  line-height: 1.3;
  letter-spacing: 0.02em;
}
.hint kbd {
  opacity: 0.9;
}
.panel-hint {
  margin-top: 8px;
  margin-bottom: 0;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  opacity: 0.62;
  font-weight: 600;
  letter-spacing: 0.01em;
}
#rightPanel[data-type="shop"] .panel-hint { color: #86efac; opacity: 0.85; }
#rightPanel[data-type="stash"] .panel-hint { color: #fcd34d; opacity: 0.8; }
#rightPanel[data-type="trunk"] .panel-hint,
#rightPanel[data-type="glovebox"] .panel-hint { color: #7dd3fc; opacity: 0.8; }

/* Shop: hide rotate hint on left when right is shop */
#app.is-shop .hint kbd:first-of-type,
#app.is-shop .hint .rotate-hint { opacity: 0.25; }

kbd {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 800;
}

.zone-div {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: rgba(181, 107, 255, 0.75);
  padding: 0;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 100000;
  border-radius: 8px;
  border: 1px solid rgba(110, 168, 255, 0.55);
  background: rgba(16, 20, 32, 0.88) center / contain no-repeat;
  opacity: 0.92;
  box-sizing: border-box;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(110, 168, 255, 0.12);
  transform: scale(1.02);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.drag-ghost.hidden {
  display: none !important;
  opacity: 0;
  background-image: none !important;
  transform: none;
}

.theme-note {
  margin: 0 0 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--inv-text-muted, #8b93a7);
}
.theme-pop {
  position: fixed;
  left: max(1.2vw, 12px);
  top: 50%;
  /* Off-screen left when closed; slides in when .is-open */
  transform: translate3d(calc(-100% - 24px), -50%, 0);
  opacity: 0;
  pointer-events: none;
  width: min(380px, 92vw);
  max-height: min(88vh, 760px);
  z-index: 100001;
  background: var(--inv-panel-bg, rgba(12, 14, 20, 0.98));
  border: 1px solid var(--inv-panel-border, rgba(255, 255, 255, 0.1));
  border-radius: var(--inv-radius, 16px);
  padding: 14px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55), 8px 0 40px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
  will-change: transform, opacity;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
}
.theme-pop.is-open {
  transform: translate3d(0, -50%, 0);
  opacity: 1;
  pointer-events: auto;
}
/* Keep layout for animation; only hard-hide when not needed for a11y */
.theme-pop.hidden {
  display: flex !important;
  visibility: hidden;
}
.theme-pop.hidden:not(.is-open) {
  pointer-events: none;
}
.theme-pop.is-open {
  visibility: visible;
}
.theme-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.theme-head strong { font-size: 14px; }
.theme-sub { margin: 2px 0 0 !important; }
.muted { font-size: 11px; opacity: 0.55; margin: 4px 0 10px; }
.theme-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}
.theme-tab {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #aeb6c8;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.theme-tab.is-active {
  color: #e8f0ff;
  border-color: color-mix(in srgb, var(--inv-accent, #6ea8ff) 45%, transparent);
  background: color-mix(in srgb, var(--inv-accent, #6ea8ff) 16%, transparent);
}
.theme-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}
.theme-pane { display: none; }
.theme-pane.is-active { display: block; }
.theme-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.theme-presets button {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #e8ecf4;
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.theme-presets button.active { border-color: var(--inv-accent, #6ea8ff); }
.theme-section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b93a7;
  margin: 10px 0 6px;
}
.theme-fields { display: flex; flex-direction: column; gap: 6px; }
.theme-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  font-weight: 650;
}
.theme-row input[type=color] {
  width: 34px; height: 28px; border: none; background: none; cursor: pointer; flex-shrink: 0;
}
.theme-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  background: #6ea8ff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.theme-swatch:hover,
.theme-swatch.is-open {
  transform: scale(1.08);
  box-shadow: 0 0 0 2px var(--inv-accent, #6ea8ff), 0 4px 12px rgba(0, 0, 0, 0.4);
}
.theme-value-chip {
  min-width: 42px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #e8ecf4;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 8px;
}
.theme-value-chip.is-open {
  border-color: var(--inv-accent, #6ea8ff);
  color: var(--inv-accent, #6ea8ff);
}
.theme-row input[type=range] {
  width: min(150px, 42vw);
  accent-color: var(--inv-accent, #6ea8ff);
}
.theme-value-pop {
  position: fixed;
  z-index: 100020;
  display: flex;
  flex-direction: row;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.16s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.theme-value-pop.is-open {
  pointer-events: auto;
  opacity: 1;
  transform: none;
}
.theme-value-pop.hidden { display: none !important; }
.theme-value-card {
  width: min(240px, 78vw);
  background: rgba(12, 14, 20, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 11px 12px 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}
.theme-value-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.theme-value-head strong {
  font-size: 12px;
  color: var(--inv-accent, #6ea8ff);
}
.theme-value-arrow {
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-right: 11px solid rgba(12, 14, 20, 0.98);
  filter: drop-shadow(-1px 0 0 rgba(255, 255, 255, 0.1));
  flex-shrink: 0;
}
.theme-value-pop.is-left {
  flex-direction: row-reverse;
}
.theme-value-pop.is-left .theme-value-arrow {
  border-right: 0;
  border-left: 11px solid rgba(12, 14, 20, 0.98);
}
.color-pop-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 10px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}
.color-pop-preview input[type=color] {
  position: absolute;
  inset: -20%;
  width: 140%;
  height: 140%;
  border: none;
  background: none;
  cursor: pointer;
  opacity: 0.01;
}
.color-pop-palette {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.color-chip {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  padding: 0;
}
.color-chip.is-on {
  box-shadow: 0 0 0 2px var(--inv-accent, #6ea8ff);
}
.color-pop-hex {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #8b93a7;
}
.color-pop-hex input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #e8ecf4;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 12px;
}
.range-pop-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.range-pop-row input[type=range] {
  flex: 1;
  accent-color: var(--inv-accent, #6ea8ff);
}
.range-pop-row .val {
  min-width: 36px;
  text-align: right;
  font-size: 12px;
  color: #e8ecf4;
}
.theme-row .val {
  min-width: 36px;
  text-align: right;
  font-size: 11px;
  color: #9aa3b8;
  font-variant-numeric: tabular-nums;
}
.theme-row.checkbox { justify-content: flex-start; gap: 10px; }
.theme-row.checkbox input { width: auto; }
.theme-actions { display: flex; gap: 8px; margin-top: 12px; flex-shrink: 0; }
.theme-actions .btn { flex: 1; }

/* 1080p–1440p polish */
@media (max-height: 900px) {
  :root {
    --cell: clamp(40px, 4.1vmin, 50px);
    --equip-frame: clamp(60px, 6.6vmin, 72px);
    --panel-pad: 12px;
    --panel-gap: 3px;
  }
  .board { max-height: min(62vh, 560px); padding: 6px; }
  .inv-wrap { max-height: 94vh; gap: var(--panel-gap); }
}
@media (min-height: 1200px) {
  :root {
    --cell: clamp(48px, 4.2vmin, 60px);
    --equip-frame: clamp(72px, 6.8vmin, 84px);
  }
  .board { max-height: min(72vh, 820px); }
}
@media (max-width: 1280px) {
  .inv-wrap { gap: 12px; padding: 1.5vh 1.5vw; }
  .equip { width: calc(var(--equip-frame) + 22px); }
}

/* ═══ Item inspection — minimal / clean ═══ */
.item-tip {
  --tip-accent: rgba(110, 168, 255, 0.85);
  position: fixed;
  z-index: 100020;
  width: 240px;
  max-width: min(260px, calc(100vw - 24px));
  padding: 12px 14px 11px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 14, 20, 0.97);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  color: #e8ecf4;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.16s ease;
}
.item-tip.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.item-tip.hidden {
  display: none !important;
}
.item-tip.rarity-uncommon { --tip-accent: rgba(74, 222, 128, 0.9); border-color: rgba(74, 222, 128, 0.22); }
.item-tip.rarity-rare { --tip-accent: rgba(96, 165, 250, 0.95); border-color: rgba(96, 165, 250, 0.25); }
.item-tip.rarity-epic { --tip-accent: rgba(192, 132, 252, 0.95); border-color: rgba(192, 132, 252, 0.28); }
.item-tip.rarity-legendary { --tip-accent: rgba(251, 191, 36, 0.95); border-color: rgba(251, 191, 36, 0.3); }

.item-tip .tip-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.item-tip .tip-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35) center / 70% no-repeat;
}
.item-tip .tip-text {
  flex: 1 1 auto;
  min-width: 0;
}
.item-tip .tip-name {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #f2f5fa;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-tip .tip-rarity {
  display: inline-block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--tip-accent);
}
.item-tip .tip-desc {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: #8b93a7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item-tip .tip-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 650;
  color: #9aa3b5;
  font-variant-numeric: tabular-nums;
}
.item-tip .tip-line span:last-child {
  color: #d5dbe8;
  font-weight: 700;
}
.item-tip .tip-line .is-price {
  color: #86efac;
}

/* Portable case — spatial grid preview (matches real container slots) */
.item-tip.has-case {
  width: auto;
  min-width: 260px;
  max-width: min(380px, calc(100vw - 20px));
  padding: 14px 16px 13px;
}
.item-tip .tip-case-badge {
  color: #fbbf24 !important;
}
.item-tip .tip-case {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.item-tip .tip-case-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fbbf24;
}
.item-tip .tip-case-title span {
  font-variant-numeric: tabular-nums;
  color: #9aa3b5;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 700;
  font-size: 11px;
}
.item-tip .tip-case-empty {
  margin: 8px 0 0;
  font-size: 11px;
  color: #6b7385;
  font-style: italic;
  text-align: center;
}

/* Preview board — same layout as real case, larger cells for readability */
.item-tip .tip-grid {
  --tip-cell: 30px;
  --tip-gap: 3px;
  --tip-cols: 8;
  --tip-rows: 2;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--tip-cols), var(--tip-cell));
  grid-template-rows: repeat(var(--tip-rows), var(--tip-cell));
  gap: var(--tip-gap);
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 45%),
    rgba(0, 0, 0, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 4px 14px rgba(0, 0, 0, 0.25);
}
.item-tip .tip-grid-cell {
  width: var(--tip-cell);
  height: var(--tip-cell);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-sizing: border-box;
}
.item-tip .tip-grid-item {
  position: relative;
  z-index: 1;
  border-radius: 5px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background-color: rgba(30, 34, 48, 0.96);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 70%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  min-width: 0;
  min-height: 0;
}
.item-tip .tip-grid-count {
  position: absolute;
  right: 2px;
  bottom: 1px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  color: #f2f5fa;
  text-shadow: 0 1px 2px #000;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* Police search / seize tray */
#app.is-police-search #rightPanel {
  box-shadow:
    0 0 0 1px rgba(232, 160, 32, 0.28),
    0 calc(12px * var(--inv-shadow, 1)) calc(36px * var(--inv-shadow, 1)) rgba(0, 0, 0, calc(0.45 * var(--inv-shadow, 1)));
}
#app.is-police-search #rightKicker,
#app.is-police-search #bagPanel .kicker {
  color: #e8a020;
  letter-spacing: 0.12em;
}
#app.is-police-search .item.has-price .price {
  background: rgba(232, 160, 32, 0.88);
  color: #14110a;
}
.seize-all-btn {
  width: 100%;
  margin-top: 8px;
  letter-spacing: 0.04em;
}
#app.is-police-search #rightBoard {
  min-height: calc(var(--cell) * 3);
  opacity: 0.92;
}

/* Right-click context menu */
.ctx-menu {
  position: fixed;
  z-index: 100002;
  min-width: 120px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 16, 22, 0.98);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ctx-menu.hidden { display: none !important; }
.ctx-item {
  border: none;
  background: transparent;
  color: #e8ecf4;
  text-align: left;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.ctx-item:hover:not(:disabled) {
  background: rgba(110, 168, 255, 0.16);
  color: #fff;
}
.ctx-item:disabled,
.ctx-item.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   Loot reveal — lock-on → slam. Finite CSS only (CEF-safe).
   ═══════════════════════════════════════════════════════════════ */
#rightPanel.is-loot-searching {
  box-shadow:
    0 0 0 1px rgba(232, 160, 32, 0.42),
    0 calc(12px * var(--inv-shadow, 1)) calc(36px * var(--inv-shadow, 1)) rgba(0, 0, 0, calc(0.45 * var(--inv-shadow, 1))),
    0 0 38px rgba(232, 160, 32, 0.22);
  animation: loot-panel-hum 0.9s ease-out forwards;
}
#rightPanel.loot-kick {
  animation: loot-panel-kick 0.16s ease-out forwards;
}
@keyframes loot-panel-hum {
  0% { box-shadow: 0 0 0 1px rgba(232, 160, 32, 0.18), 0 0 12px rgba(232, 160, 32, 0.08); }
  40% { box-shadow: 0 0 0 1px rgba(232, 160, 32, 0.55), 0 0 38px rgba(232, 160, 32, 0.28); }
  100% {
    box-shadow:
      0 0 0 1px rgba(232, 160, 32, 0.42),
      0 calc(12px * var(--inv-shadow, 1)) calc(36px * var(--inv-shadow, 1)) rgba(0, 0, 0, calc(0.45 * var(--inv-shadow, 1))),
      0 0 38px rgba(232, 160, 32, 0.22);
  }
}
@keyframes loot-panel-kick {
  0% { box-shadow: 0 0 0 1px rgba(232, 160, 32, 0.25); }
  40% { box-shadow: 0 0 0 2px rgba(255, 214, 90, 0.45), 0 0 22px rgba(232, 160, 32, 0.28); }
  100% { box-shadow: 0 0 0 1px rgba(232, 160, 32, 0.42), 0 0 38px rgba(232, 160, 32, 0.22); }
}
#rightPanel.is-loot-searching .kicker {
  color: #ffd56a;
  text-shadow: 0 0 14px rgba(255, 200, 70, 0.7);
  letter-spacing: 0.16em;
}
#rightPanel.is-loot-searching .board {
  position: relative;
  overflow: hidden;
}
#rightPanel.is-loot-searching .item {
  cursor: wait;
}
#rightPanel.is-loot-searching .board::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  border-radius: 8px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 210, 90, 0.08), transparent 55%),
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 4px,
      rgba(232, 160, 32, 0.035) 4px,
      rgba(232, 160, 32, 0.035) 5px
    );
}
#rightPanel.is-loot-searching .board.loot-sweeping::after {
  content: '';
  position: absolute;
  z-index: 14;
  pointer-events: none;
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
  background: linear-gradient(
    225deg,
    transparent 36%,
    rgba(255, 240, 180, 0.12) 44%,
    rgba(255, 214, 90, 0.7) 49%,
    rgba(255, 255, 255, 0.95) 50.5%,
    rgba(232, 160, 32, 0.65) 52%,
    rgba(255, 200, 80, 0.16) 58%,
    transparent 68%
  );
  animation: loot-board-sweep 0.86s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes loot-board-sweep {
  0% { transform: translate(46%, -46%); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translate(-46%, 46%); opacity: 0; }
}
.cell.loot-wave-cell {
  animation: loot-cell-wake 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--loot-wave, 0) * 28ms);
}
@keyframes loot-cell-wake {
  0% { box-shadow: none; }
  40% {
    border-color: rgba(255, 214, 90, 0.85) !important;
    box-shadow: inset 0 0 16px rgba(232, 160, 32, 0.42);
    background: rgba(232, 160, 32, 0.14) !important;
  }
  100% { box-shadow: none; }
}
#rightPanel.is-loot-done {
  box-shadow:
    0 0 0 1px rgba(90, 220, 140, 0.45),
    0 0 28px rgba(70, 210, 130, 0.22),
    0 calc(12px * var(--inv-shadow, 1)) calc(36px * var(--inv-shadow, 1)) rgba(0, 0, 0, calc(0.45 * var(--inv-shadow, 1)));
  animation: loot-panel-done 0.55s ease forwards;
}
@keyframes loot-panel-done {
  0% { box-shadow: 0 0 0 1px rgba(90, 220, 140, 0.7), 0 0 36px rgba(70, 210, 130, 0.35); }
  100% {
    box-shadow:
      0 0 0 1px rgba(90, 220, 140, 0.45),
      0 0 28px rgba(70, 210, 130, 0.22);
  }
}

.cell.loot-scan {
  --loot-r: 140;
  --loot-g: 150;
  --loot-b: 170;
  z-index: 1;
  overflow: hidden;
  border-color: rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.9) !important;
  background: rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.2) !important;
  box-shadow:
    inset 0 0 16px rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.4),
    0 0 12px rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.28) !important;
  animation: loot-scan-in 0.18s ease-out forwards;
}
.cell.loot-scan::after {
  content: '';
  position: absolute;
  inset: -50%;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    225deg,
    transparent 32%,
    rgba(255, 255, 255, 0.22) 46%,
    rgba(255, 255, 255, 0.85) 50%,
    rgba(255, 255, 255, 0.22) 54%,
    transparent 68%
  );
  animation: loot-scan-blade 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes loot-scan-in {
  0% { opacity: 0.35; }
  100% { opacity: 1; }
}
@keyframes loot-scan-blade {
  0% { transform: translate(45%, -45%); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translate(-45%, 45%); opacity: 0; }
}
.cell.loot-scan.loot-scan-origin {
  z-index: 1;
}
.cell.loot-scan.loot-scan-origin::before {
  content: '';
  position: absolute;
  inset: 3px;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(var(--loot-lock, #ffd56a), var(--loot-lock, #ffd56a)) top left / 9px 2px no-repeat,
    linear-gradient(var(--loot-lock, #ffd56a), var(--loot-lock, #ffd56a)) top left / 2px 9px no-repeat,
    linear-gradient(var(--loot-lock, #ffd56a), var(--loot-lock, #ffd56a)) top right / 9px 2px no-repeat,
    linear-gradient(var(--loot-lock, #ffd56a), var(--loot-lock, #ffd56a)) top right / 2px 9px no-repeat,
    linear-gradient(var(--loot-lock, #ffd56a), var(--loot-lock, #ffd56a)) bottom left / 9px 2px no-repeat,
    linear-gradient(var(--loot-lock, #ffd56a), var(--loot-lock, #ffd56a)) bottom left / 2px 9px no-repeat,
    linear-gradient(var(--loot-lock, #ffd56a), var(--loot-lock, #ffd56a)) bottom right / 9px 2px no-repeat,
    linear-gradient(var(--loot-lock, #ffd56a), var(--loot-lock, #ffd56a)) bottom right / 2px 9px no-repeat;
  animation: loot-lock-in 0.2s ease-out both;
}
@keyframes loot-lock-in {
  0% { opacity: 0; transform: scale(1.18); }
  100% { opacity: 1; transform: none; }
}
.cell.loot-scan.loot-scan-foot { opacity: 0.88; }
.cell.loot-scan-cash::after {
  content: '$';
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: calc(var(--cell) * 0.4);
  color: #7dffb0;
  text-shadow: 0 0 12px rgba(80, 255, 160, 0.8);
  pointer-events: none;
  animation: loot-cash-pop 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  background: none;
}
@keyframes loot-cash-pop {
  0% { transform: scale(0.4); opacity: 0; }
  55% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.cell.loot-scan.rarity-common,
.cell.loot-settled.rarity-common,
.cell.loot-impact.rarity-common {
  --loot-r: 160; --loot-g: 170; --loot-b: 185; --loot-lock: #c8d0dc;
}
.cell.loot-scan.rarity-uncommon,
.cell.loot-settled.rarity-uncommon,
.cell.loot-impact.rarity-uncommon {
  --loot-r: 50; --loot-g: 220; --loot-b: 120; --loot-lock: #3dd68c;
}
.cell.loot-scan.rarity-rare,
.cell.loot-settled.rarity-rare,
.cell.loot-impact.rarity-rare {
  --loot-r: 60; --loot-g: 150; --loot-b: 255; --loot-lock: #6ea8ff;
}
.cell.loot-scan.rarity-epic,
.cell.loot-settled.rarity-epic,
.cell.loot-impact.rarity-epic {
  --loot-r: 190; --loot-g: 80; --loot-b: 255; --loot-lock: #c85cff;
}
.cell.loot-scan.rarity-legendary,
.cell.loot-settled.rarity-legendary,
.cell.loot-impact.rarity-legendary {
  --loot-r: 255; --loot-g: 190; --loot-b: 40; --loot-lock: #ffd24a;
}

.cell.loot-settled {
  border-color: rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.55) !important;
  background: rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.08) !important;
  box-shadow: none !important;
  animation: none !important;
  transform: none;
}
.cell.loot-impact {
  z-index: 6;
  animation: loot-cell-impact 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes loot-cell-impact {
  0% { box-shadow: 0 0 0 0 rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.7); }
  40% {
    box-shadow:
      0 0 0 3px rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.55),
      0 0 22px rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.45);
  }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.item.loot-materialize {
  --loot-glow: rgba(160, 175, 200, 0.65);
  z-index: 8;
  overflow: hidden;
  animation: loot-materialize 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.item.loot-materialize.rarity-common { --loot-glow: rgba(170, 180, 200, 0.55); }
.item.loot-materialize.rarity-uncommon { --loot-glow: rgba(50, 230, 130, 0.85); animation-duration: 0.54s; }
.item.loot-materialize.rarity-rare { --loot-glow: rgba(70, 150, 255, 0.95); animation-duration: 0.56s; }
.item.loot-materialize.rarity-epic { --loot-glow: rgba(200, 90, 255, 1); animation-duration: 0.6s; }
.item.loot-materialize.rarity-legendary { --loot-glow: rgba(255, 200, 50, 1); animation-duration: 0.66s; }

.item.loot-materialize::after {
  content: '';
  position: absolute;
  inset: -18%;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(circle, var(--loot-glow) 0%, transparent 68%);
  animation: loot-bloom 0.55s ease-out both;
}
.item.loot-materialize.rarity-legendary::before,
.item.loot-materialize.rarity-epic::before {
  content: '';
  position: absolute;
  inset: -8%;
  z-index: 1;
  pointer-events: none;
  border-radius: 50%;
  border: 2px solid var(--loot-glow);
  animation: loot-shock 0.55s ease-out both;
}

@keyframes loot-materialize {
  0% {
    opacity: 0;
    transform: scale(0.72);
  }
  55% {
    opacity: 1;
    transform: scale(1.06);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}
@keyframes loot-bloom {
  0% { opacity: 0.95; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(1.35); }
}
@keyframes loot-shock {
  0% { opacity: 0.9; transform: scale(0.5); }
  100% { opacity: 0; transform: scale(1.7); }
}

.loot-spark {
  position: absolute;
  width: 5px;
  height: 5px;
  margin: -2px 0 0 -2px;
  border-radius: 1px;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 0 8px currentColor;
  animation: loot-spark 0.5s ease-out both;
}
@keyframes loot-spark {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--sx), var(--sy)) scale(0.15); opacity: 0; }
}

/* Persistent rarity border on items (from metadata.rarity) */
.item.has-rarity.rarity-common {
  border-color: rgba(160, 170, 185, 0.4) !important;
  box-shadow: 0 0 0 1px rgba(160, 170, 185, 0.35), 0 2px 8px rgba(0, 0, 0, 0.35);
}
.item.has-rarity.rarity-uncommon {
  border-color: rgba(50, 220, 120, 0.75) !important;
  box-shadow: 0 0 0 1px rgba(50, 220, 120, 0.5), 0 0 14px rgba(40, 200, 110, 0.4);
}
.item.has-rarity.rarity-rare {
  border-color: rgba(70, 150, 255, 0.85) !important;
  box-shadow: 0 0 0 1px rgba(70, 150, 255, 0.55), 0 0 16px rgba(60, 140, 255, 0.5);
}
.item.has-rarity.rarity-epic {
  border-color: rgba(190, 90, 255, 0.9) !important;
  box-shadow: 0 0 0 1px rgba(190, 90, 255, 0.6), 0 0 18px rgba(180, 80, 255, 0.55);
}
.item.has-rarity.rarity-legendary {
  border-color: rgba(255, 200, 50, 0.95) !important;
  box-shadow: 0 0 0 1px rgba(255, 200, 50, 0.65), 0 0 20px rgba(255, 190, 40, 0.55);
}

#app.loot-search-mode #rightPanel .panel-hint {
  color: rgba(255, 213, 106, 0.9);
  letter-spacing: 0.04em;
}
/* CEF: never apply CSS filter to item icons while looting — compositor freeze */
#app.loot-search-mode .item,
#app.loot-search-mode #rightPanel,
#app.loot-search-mode .board {
  filter: none !important;
}

/* ── Floating case window (portable DU_Cases) ───────────── */
.case-float {
  position: fixed;
  z-index: 40;
  left: 58%;
  top: 18%;
  width: max-content;
  max-width: min(92vw, 520px);
  pointer-events: auto;
  border-radius: calc(var(--inv-radius, 14px) + 2px);
  border: 1px solid rgba(240, 160, 32, 0.35);
  background: linear-gradient(165deg, rgba(28, 22, 12, 0.97), rgba(10, 10, 12, 0.98));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  padding: 10px 12px 12px;
  animation: caseFloatIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.case-float.hidden { display: none !important; }
@keyframes caseFloatIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.case-float-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.case-float-head:active { cursor: grabbing; }
.case-float-titles .kicker {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: #f0a020;
  font-weight: 700;
}
.case-float-titles h2 {
  margin: 2px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.case-float-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.case-float-close {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px;
  padding: 0 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
}
.case-hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--inv-text-muted, #8b93a7);
}

/* While dragging over / from floating case: main inventory underneath ignores hits */
#app.case-modal-drag .inv-wrap {
  pointer-events: none !important;
}
#app.case-modal-drag .case-float {
  pointer-events: auto !important;
}
#app.case-modal-drag .case-float .case-float-head {
  pointer-events: auto;
}
/* Case window always above bag panels for hit-testing */
.case-float {
  z-index: 50 !important;
}
.case-float .board .cell,
.case-float .board .item {
  pointer-events: auto;
}

/* ── Loot search progress ring (built-in, was DU_Looting NUI) ── */
:root {
  --loot-size: 92px;
  --loot-opacity: 0.78;
  --loot-thick: 3.4;
  --loot-track: rgba(255, 255, 255, 0.14);
}
.progress-root {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
  z-index: 80;
  background: transparent !important;
}
.progress-ring {
  position: relative;
  width: var(--loot-size, 92px);
  height: var(--loot-size, 92px);
  border-radius: 50%;
  background: rgba(8, 10, 16, 0.72);
  box-shadow:
    0 0 0 1px rgba(255, 213, 106, 0.18),
    0 10px 32px rgba(0, 0, 0, 0.45),
    0 0 24px rgba(255, 200, 70, 0.12);
  opacity: 0;
  transform: scale(0.86);
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-root.is-on .progress-ring {
  opacity: 1;
  transform: scale(1);
}
.progress-root.is-out .progress-ring {
  opacity: 0;
  transform: scale(0.9);
}
.progress-root.is-success .progress-ring {
  animation: loot-ring-ok 0.42s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes loot-ring-ok {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.ring-glow {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 213, 106, 0.22), transparent 70%);
  pointer-events: none;
}
.progress-svg {
  width: 100%;
  height: 100%;
  display: block;
  transform: rotate(-90deg);
}
.ring-track {
  fill: none;
  stroke: var(--loot-track);
  stroke-width: var(--loot-thick, 3.4);
}
.ring-fill {
  fill: none;
  stroke: #ffd56a;
  stroke-width: var(--loot-thick, 3.4);
  stroke-linecap: round;
  stroke-dasharray: 263.89;
  stroke-dashoffset: 263.89;
}
.ring-fill.ok { stroke: #3dd68c; }
.ring-fill.fail { stroke: #ff6b7a; }
.progress-pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--loot-size, 92px) * 0.2);
  font-weight: 800;
  color: rgba(255, 248, 230, 0.95);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}
.progress-root.hide-pct .progress-pct { display: none; }
.progress-label {
  max-width: 240px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 230, 170, 0.88);
  opacity: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.progress-root.is-on .progress-label:not(.hidden) { opacity: 1; }
.progress-hint {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.42);
  opacity: 0;
}
.progress-root.is-on .progress-hint:not(.hidden) { opacity: 1; }

/* ── Help coaches: one card + arrow per panel (udstyr / taske / drop) ── */
.help-layer {
  position: fixed;
  inset: 0;
  z-index: 100010;
  pointer-events: none;
}
.help-layer.hidden { display: none !important; }
.help-coach {
  position: fixed;
  z-index: 100011;
  width: min(250px, 78vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.help-layer.is-open .help-coach.is-step { opacity: 1; transform: none; visibility: visible; }
.help-layer.is-open .help-coach:not(.is-step) { opacity: 0; visibility: hidden; pointer-events: none; }
.help-coach-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.help-coach-nav .help-step {
  flex: 1;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--inv-text-muted, #8b93a7);
}
.help-prev, .help-next, .help-x {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #e8ecf4;
  border-radius: 8px;
  min-width: 32px;
  min-height: 32px;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.help-prev:hover, .help-next:hover, .help-x:hover {
  border-color: var(--inv-accent, #6ea8ff);
  color: #fff;
}
.help-coach-card {
  background: rgba(12, 14, 20, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px 9px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  color: var(--inv-text, #d5d9e2);
  width: 100%;
  box-sizing: border-box;
}
.help-coach-card strong {
  display: block;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--inv-accent, #6ea8ff);
  margin-bottom: 4px;
}
.help-coach-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.help-coach-head strong { margin-bottom: 0; }
.help-coach-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #c8ceda;
}
.help-coach-list {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  font-size: 11.5px;
  color: var(--inv-text-muted, #8b93a7);
}
.help-coach-list kbd {
  display: inline-block;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #e8ecf4;
  font-size: 11px;
}
.help-coach-arrow {
  width: 0;
  height: 0;
  flex: 0 0 auto;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 11px solid rgba(12, 14, 20, 0.97);
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.1));
}
.help-coach.is-below { flex-direction: column; }
.help-coach.is-below .help-coach-arrow {
  order: -1;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 0;
  border-bottom: 11px solid rgba(12, 14, 20, 0.97);
}
.help-coach.is-left {
  flex-direction: row;
  align-items: center;
  width: min(230px, 42vw);
}
.help-coach.is-left .help-coach-arrow {
  border: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 11px solid rgba(12, 14, 20, 0.97);
}
.help-coach.is-right {
  flex-direction: row;
  align-items: center;
  width: min(230px, 42vw);
}
.help-coach.is-right .help-coach-arrow {
  order: -1;
  border: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-right: 11px solid rgba(12, 14, 20, 0.97);
}
.is-help-target {
  outline: 2px solid var(--inv-accent, #6ea8ff);
  outline-offset: 3px;
  box-shadow: 0 0 0 1px rgba(110, 168, 255, 0.22);
}
.ghost-row.is-help-target,
.craft-ghost.is-help-target {
  outline-offset: 2px;
}

.invadmin {
  position: fixed;
  z-index: 90;
  left: max(1.2vw, 12px);
  top: 50%;
  transform: translate3d(calc(-100% - 28px), -50%, 0);
  opacity: 0;
  pointer-events: none;
  width: min(400px, 92vw);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  color: var(--inv-text, #f0eadc);
  border-color: rgba(232, 197, 106, 0.22);
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
}
.invadmin.is-open {
  transform: translate3d(0, -50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.invadmin.hidden { display: none !important; }
.invadmin .kicker { color: #e8c56a; }
.invadmin .panel-head { margin-bottom: 10px; }
.ia-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 10px;
  padding: 3px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.055);
  flex-shrink: 0;
}
.ia-tab {
  flex: 1 1 0;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--inv-text-muted, #b7aa94);
  font: 700 11px/1 inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.ia-tab.is-on {
  color: #1a1408;
  background: #e8c56a;
}
.ia-panes {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.ia-pane { display: none; }
.ia-pane.is-on { display: block; }
.invadmin .muted { color: #b7aa94; font-size: 12px; margin: 0 0 10px; }
.invadmin-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.invadmin-presets .btn { padding: 6px 10px; font-size: 12px; }
.invadmin-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-bottom: 12px; }
.ia-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.ia-row input[type="color"] {
  width: 42px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer;
}
.invadmin-json {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px;
  font-size: 11px;
  line-height: 1.4;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  color: #d8d0c0;
}
.invadmin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ── Separate activity console (right) ── */
.ia-console {
  position: fixed;
  z-index: 90;
  right: max(1.2vw, 12px);
  top: 50%;
  transform: translate3d(calc(100% + 28px), -50%, 0);
  opacity: 0;
  pointer-events: none;
  width: min(560px, 94vw);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  min-height: min(62vh, 560px);
  padding: 10px 12px 8px;
  border-radius: 12px;
  background: rgba(7, 9, 12, 0.97);
  border: 1px solid rgba(90, 220, 140, 0.16);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  color: #c8d4c8;
  font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
}
.ia-console.is-open {
  transform: translate3d(0, -50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.ia-console.hidden { display: none !important; }
.ia-con-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 2px 2px 8px;
  border-bottom: 1px solid rgba(90, 220, 140, 0.12);
  margin-bottom: 8px;
}
.ia-con-traffic {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}
.ia-con-traffic i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: block;
}
.ia-con-traffic i:nth-child(1) { background: #ff5f57; }
.ia-con-traffic i:nth-child(2) { background: #febc2e; }
.ia-con-traffic i:nth-child(3) { background: #28c840; }
.ia-con-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #9dffc0;
}
.ia-con-path {
  margin-left: auto;
  font-size: 11px;
  color: #6f8576;
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ia-console .btn.icon {
  width: 26px;
  height: 26px;
  color: #8aa090;
}
.ia-con-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.ia-con-toolbar select,
.ia-con-toolbar input {
  flex: 1 1 140px;
  min-width: 0;
  height: 30px;
  border-radius: 6px;
  border: 1px solid rgba(90, 220, 140, 0.16);
  background: rgba(0, 0, 0, 0.45);
  color: #d5ead8;
  padding: 0 9px;
  font: 12px/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.ia-con-toolbar .btn {
  height: 30px;
  padding: 0 12px;
  font: 700 11px/1 ui-monospace, Consolas, monospace;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: #0c140f;
  background: #7dffb0;
  border-color: #7dffb0;
}
.ia-log-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.ia-log-filters .btn {
  padding: 4px 8px;
  font: 700 10px/1 ui-monospace, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  background: rgba(255, 255, 255, 0.04);
  color: #8aa090;
  border-color: rgba(255, 255, 255, 0.06);
}
.ia-log-filters .btn.is-on {
  color: #0c140f;
  background: #7dffb0;
  border-color: #7dffb0;
}
.ia-con-body {
  flex: 1 1 auto;
  min-height: 220px;
  overflow: auto;
  background: #050608;
  border: 1px solid rgba(90, 220, 140, 0.1);
  border-radius: 8px;
  padding: 8px 10px 10px;
  font-size: 12px;
  line-height: 1.55;
  user-select: text;
  cursor: text;
}
.ia-con-line {
  display: grid;
  grid-template-columns: 68px 56px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  white-space: nowrap;
}
.ia-con-line.is-sys {
  display: block;
  color: #6f8576;
  white-space: normal;
}
.ia-con-time {
  color: #5c6d62;
  font-variant-numeric: tabular-nums;
}
.ia-con-act {
  font-weight: 700;
  letter-spacing: 0.03em;
}
.ia-con-act.buy, .ia-con-act.cloth { color: #7dffb0; }
.ia-con-act.loot { color: #5eead4; }
.ia-con-act.craft { color: #fda4af; }
.ia-con-act.drop { color: #ff9a4a; }
.ia-con-act.pickup { color: #6ea8ff; }
.ia-con-act.move { color: #e8c56a; }
.ia-con-act.give { color: #c85cff; }
.ia-con-msg {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #d5ead8;
}
.ia-con-msg em {
  font-style: normal;
  color: #8aa090;
  margin-left: 8px;
}
.ia-con-n {
  color: #9dffc0;
  font-variant-numeric: tabular-nums;
}
.ia-con-cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  margin-left: 2px;
  background: #7dffb0;
  vertical-align: -2px;
  animation: ia-con-blink 1.05s steps(1) infinite;
}
@keyframes ia-con-blink {
  50% { opacity: 0; }
}
.ia-con-foot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(90, 220, 140, 0.1);
  font-size: 11px;
  color: #6f8576;
}
.ia-con-prompt {
  color: #7dffb0;
  font-weight: 800;
}

/* Customize: hide the whole inventory — only cinematic gun + tray */
#app.is-customize .inv-wrap,
#app.is-customize #caseFloat,
#app.is-customize #themePop,
#app.is-customize #themeValuePop {
  display: none !important;
}

/* ═══ Weapon customize — side tray over cinematic 3D gun ═══ */
.cust-stage {
  position: fixed;
  inset: 0;
  z-index: 100040;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 2.2vw 0 0;
  pointer-events: none;
}
.cust-card {
  pointer-events: auto;
  width: min(300px, 28vw);
  padding: 14px 14px 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 14, 20, 0.94);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.cust-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cust-head h2 {
  margin: 2px 0 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.cust-scene {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 0;
}
.cust-weapon {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 10, 16, 0.75);
}
.cust-weapon-art {
  width: 88px;
  height: 40px;
  background: center / contain no-repeat;
}
.cust-weapon-name {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: #e8ecf4;
}
.cust-box {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 20, 28, 0.96);
  padding: 8px;
  min-height: 96px;
}
.cust-box-color {
  min-height: 64px;
}
.cust-box.is-over {
  border-color: var(--inv-accent, #6ea8ff);
  box-shadow:
    0 10px 0 rgba(0, 0, 0, 0.35),
    0 0 0 2px rgba(110, 168, 255, 0.35);
}
.cust-box-label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b93a7;
  margin-bottom: 6px;
}
.cust-box-slot {
  height: 72px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.28) center / 58% no-repeat;
}
.cust-box-slot.has-part {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.16);
}
.cust-tints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cust-tint {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  padding: 0;
}
.cust-tint.is-on {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}
.cust-parts-wrap {
  margin-top: 2px;
}
.cust-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 40px;
}
.cust-part {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.cust-part:hover {
  border-color: var(--inv-accent, #6ea8ff);
}
.cust-part-art {
  display: block;
  width: 100%;
  height: 100%;
  background: center / 70% no-repeat;
}
.cust-parts-empty {
  margin: 0;
  font-size: 11px;
  color: #8b93a7;
}
.cust-hint {
  margin: 12px 2px 0;
  font-size: 11px;
  color: #8b93a7;
  line-height: 1.4;
}
.item.is-attach-ok {
  outline: 1px solid rgba(110, 168, 255, 0.45);
}

/* Clothing: never paint the world. Only the left card is opaque. */
html.cloth-mode,
body.cloth-mode,
html.cloth-mode #app,
body.cloth-mode #app {
  background: transparent !important;
  background-color: rgba(0, 0, 0, 0) !important;
}
html.cloth-mode #app,
body.cloth-mode #app {
  display: none !important;
}
html.cloth-mode #needHud,
body.cloth-mode #needHud {
  display: none !important;
}
html.cloth-mode #app::before,
html.cloth-mode #app::after,
body.cloth-mode::before,
body.cloth-mode::after {
  display: none !important;
  content: none !important;
  opacity: 0 !important;
  background: none !important;
}

/* ═══ Clothing shop — left panel, player stays visible ═══ */
.cloth-shop {
  position: fixed;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: min(340px, 36vw);
  z-index: 100020;
  padding: 16px 16px 14px;
  border-radius: var(--inv-radius, 16px);
  background: var(--inv-panel-bg, linear-gradient(180deg, rgba(16, 18, 22, 0.96), rgba(8, 9, 12, 0.97)));
  border: 1px solid var(--inv-panel-border, rgba(255, 255, 255, 0.08));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  color: var(--inv-text, #e8ecf4);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cloth-shop.hidden { display: none !important; }
.cloth-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.cloth-head .kicker {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: var(--inv-kicker, #e8a020);
}
.cloth-head h2 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 700;
}
.cloth-rows { display: flex; flex-direction: column; gap: 8px; }
.cloth-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px 10px;
  padding: 8px 8px 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.cloth-row:hover { border-color: rgba(232, 160, 32, 0.32); }
.cloth-row.is-on {
  border-color: rgba(232, 160, 32, 0.58);
  background: rgba(232, 160, 32, 0.10);
}
.cloth-row strong {
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 12px;
  font-weight: 700;
  color: #e8ecf4;
}
.cloth-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.cloth-ctrl span {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 650;
  color: #c9d0dc;
  font-variant-numeric: tabular-nums;
}
.cloth-ctrl button,
.cloth-shop .btn.icon {
  width: 26px;
  height: 26px;
  min-width: 26px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #e8ecf4;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.cloth-ctrl button:hover { border-color: #e8a020; color: #e8a020; }
.cloth-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
}
.cloth-price {
  font-size: 15px;
  font-weight: 750;
  color: #e8a020;
  font-variant-numeric: tabular-nums;
}
