.supply-crate-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 55;
  width: min(560px, calc(100vw - 32px));
  max-height: min(72vh, 640px);
  overflow-y: auto;
  transform: translate(-50%, -50%);
  border: 3px solid #4d5639;
  outline: 1px solid rgba(0, 0, 0, 0.55);
  border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0 2px, rgba(255, 255, 255, 0.015) 2px 4px, transparent 4px 72px),
    linear-gradient(165deg, #313724, #232819 62%, #1d2115);
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(220, 228, 190, 0.12),
    inset 0 -14px 30px rgba(0, 0, 0, 0.3);
  color: #e6ecd6;
  pointer-events: auto;
  animation: supply-crate-open 0.16s ease-out;
}

@keyframes supply-crate-open {
  from {
    transform: translate(-50%, -47%) scale(0.94);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.supply-crate-panel.hidden {
  display: none;
}

.supply-crate-panel header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px 9px 16px;
  border-bottom: 2px dashed rgba(220, 228, 190, 0.22);
  background: linear-gradient(180deg, rgba(28, 32, 20, 0.97), rgba(28, 32, 20, 0.88));
}

.supply-crate-panel header strong {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: #dde4c4;
}

.supply-crate-panel header strong::before {
  content: "★";
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(220, 228, 190, 0.4);
  border-radius: 4px;
  font-size: 11px;
  letter-spacing: 0;
  color: #ffd166;
  background: rgba(0, 0, 0, 0.28);
}

.supply-crate-panel header button {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(220, 228, 190, 0.22);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  color: #e6ecd6;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.supply-crate-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 14px 16px;
}

.supply-crate-cat h4 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 7px;
  padding: 3px 10px 3px 4px;
  border: 1px dashed rgba(220, 228, 190, 0.3);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: #c9d2a8;
}

.supply-crate-cat h4 span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: rgba(255, 209, 102, 0.18);
  color: #ffd166;
  font-size: 11px;
  letter-spacing: 0;
}

.supply-crate-cat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.supply-crate-item {
  position: relative;
  display: grid;
  grid-template-rows: 52px auto;
  justify-items: center;
  gap: 6px;
  padding: 10px 8px 9px;
  border: 1px solid rgba(220, 228, 190, 0.2);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.18));
  background-color: #20251a;
  color: #e6ecd6;
  text-align: center;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(220, 228, 190, 0.08);
}

.supply-crate-item:hover:not(:disabled),
.supply-crate-item:focus-visible:not(:disabled) {
  border-color: rgba(255, 209, 102, 0.7);
  background-color: #2a2f1e;
  box-shadow:
    inset 0 1px 0 rgba(255, 209, 102, 0.14),
    0 0 0 1px rgba(255, 209, 102, 0.25);
}

.supply-crate-item:disabled {
  opacity: 0.38;
  filter: grayscale(0.6);
  cursor: default;
}

.supply-crate-item-art {
  display: grid;
  place-items: center;
  width: 100%;
  height: 52px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0 6px, transparent 6px 12px),
    rgba(0, 0, 0, 0.3);
}

.supply-crate-item-art img {
  max-width: 64px;
  max-height: 40px;
  object-fit: contain;
}

.supply-crate-item strong {
  min-width: 0;
  max-width: 100%;
  font-size: 12.5px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.supply-crate-item b {
  position: absolute;
  top: 5px;
  right: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: #ffd166;
  font-size: 10.5px;
  font-weight: 900;
}

@media (max-width: 720px) {
  .supply-crate-panel {
    width: min(480px, calc(100vw - 20px));
    max-height: 68vh;
  }

  .supply-crate-cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
