/* 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);
  will-change: opacity, transform;
}
#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);
    filter: brightness(1.15);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
}
.item.item-enter {
  animation: du-item-in 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.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-shop { color: #4ade80; }

#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="hunger"] .vital-track i { background: #e0a040; }
.vital[data-k="thirst"] .vital-track i { background: #6ea8ff; }
.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;
}
.need-hud.is-edit .need-stack {
  transform: none !important;
  transform-style: flat;
}
.need-hud.is-edit .need-wep {
  transform: none;
}
.need-hud.is-edit [data-hud] {
  cursor: grab;
  outline: 1px dashed rgba(255, 255, 255, 0.38);
  outline-offset: 6px;
  pointer-events: auto;
}
.need-hud.is-edit [data-hud].is-dragging {
  cursor: grabbing;
  outline-color: var(--need-slot, #ffd56a);
  transition: none !important;
}
.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: fixed;
  margin: 0;
  z-index: 9;
  transform: none;
}
.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.is-empty {
  opacity: 0.7;
}
.need-wep.is-empty .need-wep-art { background-image: none !important; }
.need-wep.is-on {
  border-color: var(--need-slot, #ffd56a);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--need-slot, #ffd66e) 38%, transparent), rgba(24, 18, 8, 0.78));
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--need-slot, #ffd25a) 42%, transparent),
    0 0 22px color-mix(in srgb, var(--need-slot, #ffc440) 50%, transparent),
    inset 0 1px 0 rgba(255, 240, 180, 0.4);
}
.need-wep.is-on em {
  color: var(--need-slot, #ffe7a8);
}

.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="hunger"] .need-lab { color: var(--need-hunger, #ffd56a); }
.need-rail[data-k="thirst"] .need-lab { color: var(--need-thirst, #9fd4ff); }
.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="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; }
}

.ghost-row {
  display: flex;
  gap: 10px;
  margin: 0 0 3px;
}
.craft-ghost {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--inv-ghost, rgba(232, 208, 138, 0.22));
  font: 600 9px/1 inherit;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}
.craft-ghost:hover,
.craft-ghost.is-ghost-on {
  color: var(--inv-ghost-hover, rgba(232, 208, 138, 0.74));
}
.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 {
  border: 0;
  border-radius: 9px;
  height: 34px;
  padding: 0 12px;
  background: linear-gradient(180deg, #f0b84a, #d49216);
  color: #1a1306;
  font: 800 12px inherit;
  cursor: pointer;
  white-space: nowrap;
}
.craft-make:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
.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;
}
.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;
  filter: saturate(0.7);
}
.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);
}

/* —— 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;
}
.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;
  /* Soft scale/opacity only — left/top are driven by rAF (no CSS lag) */
  will-change: left, top, transform, opacity;
  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 {
  opacity: 0;
  transform: scale(0.98);
}

.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: 100001;
  width: 220px;
  max-width: min(220px, 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 — one gold sweep, top-right → bottom-left
   ═══════════════════════════════════════════════════════════════ */
#rightPanel.is-loot-searching {
  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))),
    0 0 26px rgba(232, 160, 32, 0.12);
}
#rightPanel.is-loot-searching .kicker {
  color: #f0c060;
  text-shadow: 0 0 10px rgba(232, 160, 32, 0.45);
  letter-spacing: 0.12em;
}
#rightPanel.is-loot-searching .board {
  position: relative;
  overflow: hidden;
}
#rightPanel.is-loot-searching .board::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  border-radius: 8px;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(232, 160, 32, 0.025) 3px,
    rgba(232, 160, 32, 0.025) 4px
  );
  opacity: 0.5;
  animation: none !important;
}
#rightPanel.is-loot-searching .board.loot-sweeping::after {
  content: '';
  position: absolute;
  z-index: 14;
  pointer-events: none;
  width: 180%;
  height: 180%;
  top: -40%;
  left: -40%;
  background: linear-gradient(
    225deg,
    transparent 38%,
    rgba(255, 230, 160, 0.08) 44%,
    rgba(255, 214, 90, 0.55) 49%,
    rgba(255, 255, 255, 0.92) 50.5%,
    rgba(232, 160, 32, 0.5) 52%,
    rgba(255, 200, 80, 0.12) 58%,
    transparent 66%
  );
  animation: loot-board-sweep 0.72s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes loot-board-sweep {
  0% { transform: translate(42%, -42%); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translate(-42%, 42%); opacity: 0; }
}
.cell.loot-wave-cell {
  animation: loot-cell-wake 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--loot-wave, 0) * 22ms);
}
@keyframes loot-cell-wake {
  0% { box-shadow: none; }
  45% {
    border-color: rgba(255, 214, 90, 0.7) !important;
    box-shadow: inset 0 0 14px rgba(232, 160, 32, 0.35);
    background: rgba(232, 160, 32, 0.1) !important;
  }
  100% { box-shadow: none; }
}
#rightPanel.is-loot-done {
  box-shadow:
    0 0 0 1px rgba(90, 220, 140, 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)));
  transition: box-shadow 0.45s ease;
}

.cell.loot-scan {
  --loot-r: 140;
  --loot-g: 150;
  --loot-b: 170;
  z-index: 5 !important;
  overflow: hidden;
  border-color: rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.75) !important;
  background: rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.14) !important;
  box-shadow: inset 0 0 10px rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.25) !important;
  animation: loot-scan-in 0.22s ease-out both;
}
.cell.loot-scan::after {
  content: '';
  position: absolute;
  inset: -40%;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    225deg,
    transparent 35%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 65%
  );
  animation: loot-scan-blade 0.32s 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(40%, -40%); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(-40%, 40%); opacity: 0; }
}
.cell.loot-scan::before { display: none !important; content: none !important; }
.cell.loot-scan.loot-scan-origin {
  outline: 1px solid rgba(var(--loot-r), var(--loot-g), var(--loot-b), 0.9) !important;
  outline-offset: -1px;
  z-index: 6 !important;
}
.cell.loot-scan.loot-scan-foot { opacity: 0.85; }
.cell.loot-scan-cash::after {
  content: '$';
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: calc(var(--cell) * 0.32);
  color: #7dffb0;
  pointer-events: none;
  animation: none;
  background: none;
}

/* Rarity palettes */
.cell.loot-scan.rarity-common,
.cell.loot-settled.rarity-common {
  --loot-r: 160; --loot-g: 170; --loot-b: 185;
}
.cell.loot-scan.rarity-uncommon,
.cell.loot-settled.rarity-uncommon {
  --loot-r: 50; --loot-g: 220; --loot-b: 120;
}
.cell.loot-scan.rarity-rare,
.cell.loot-settled.rarity-rare {
  --loot-r: 60; --loot-g: 150; --loot-b: 255;
}
.cell.loot-scan.rarity-epic,
.cell.loot-settled.rarity-epic {
  --loot-r: 190; --loot-g: 80; --loot-b: 255;
}
.cell.loot-scan.rarity-legendary,
.cell.loot-settled.rarity-legendary {
  --loot-r: 255; --loot-g: 190; --loot-b: 40;
}

.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;
}

.item.loot-materialize {
  --loot-glow: rgba(160, 175, 200, 0.65);
  z-index: 7;
  animation: loot-materialize 0.36s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.item.loot-materialize.rarity-common { --loot-glow: rgba(170, 180, 200, 0.7); }
.item.loot-materialize.rarity-uncommon { --loot-glow: rgba(50, 230, 130, 0.85); }
.item.loot-materialize.rarity-rare { --loot-glow: rgba(70, 150, 255, 0.9); }
.item.loot-materialize.rarity-epic { --loot-glow: rgba(200, 90, 255, 0.95); }
.item.loot-materialize.rarity-legendary { --loot-glow: rgba(255, 200, 50, 1); }

@keyframes loot-materialize {
  0% {
    opacity: 0;
    transform: translate(18%, -18%) scale(0.84);
    clip-path: polygon(100% 0%, 100% 0%, 100% 0%);
  }
  28% {
    opacity: 1;
    clip-path: polygon(42% -8%, 108% -8%, 108% 38%);
  }
  62% {
    transform: translate(3%, -3%) scale(1.04);
    clip-path: polygon(-8% -8%, 108% -8%, 108% 108%, 18% 108%);
  }
  100% {
    opacity: 1;
    transform: none;
    clip-path: polygon(-12% -12%, 112% -12%, 112% 112%, -12% 112%);
  }
}

/* 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(0, 230, 255, 0.85);
  letter-spacing: 0.04em;
}

/* ── 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: 72px;
  --loot-opacity: 0.5;
  --loot-thick: 2.5;
  --loot-track: rgba(255, 255, 255, 0.12);
}
.progress-root {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  z-index: 80;
  background: transparent !important;
}
.progress-ring {
  position: relative;
  width: var(--loot-size, 72px);
  height: var(--loot-size, 72px);
  border-radius: 50%;
  background: rgba(8, 10, 16, calc(var(--loot-opacity, 0.5) * 0.55));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 8px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-root.is-on .progress-ring {
  opacity: var(--loot-opacity, 0.5);
  transform: scale(1);
}
.progress-root.is-out .progress-ring {
  opacity: 0;
  transform: scale(0.94);
}
.progress-svg {
  width: 100%;
  height: 100%;
  display: block;
  transform: rotate(-90deg);
}
.ring-track {
  fill: none;
  stroke: var(--loot-track);
  stroke-width: var(--loot-thick, 2.5);
}
.ring-fill {
  fill: none;
  stroke: var(--inv-accent, #6ea8ff);
  stroke-width: var(--loot-thick, 2.5);
  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, 72px) * 0.18);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.progress-root.hide-pct .progress-pct { display: none; }
.progress-label {
  max-width: 220px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  opacity: 0;
}
.progress-root.is-on .progress-label:not(.hidden) { opacity: 1; }
.progress-hint {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.35);
  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 { opacity: 1; transform: none; }
.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);
}

/* 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 #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);
}
.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;
}
