.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  padding: 24px;
  box-sizing: border-box;
}

.modal-content {
  background-color: #1a1a1a;
  padding: 18px;
  border-radius: 8px;
  width: 100%;
  max-width: min(1320px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  color: #fff;
  font-family: sans-serif;
  position: relative;
  overflow: auto;
  box-sizing: border-box;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  color: #fff;
}

#inventory-layout {
  display: flex;
  flex-direction: row;
  gap: 24px;
  align-items: flex-start;
  justify-content: center;
}

#bag-area {
  flex-shrink: 0;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(15, 54px);
  grid-auto-rows: 54px;
  gap: 5px;
}

.slot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  margin-top: 20px;
}

.slot-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 54px;
}

.slot {
  width: 54px;
  height: 54px;
  background-color: #20222a;
  border: 1px solid #4b5060;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 3px;
  border-radius: 4px;
  overflow: hidden;
}

.slot.is-empty {
  opacity: 0.32;
  background: #181a20;
  border-color: #303440;
}

.slot-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background-color: transparent;
  position: relative;
  overflow: hidden;
}

.slot-icon img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  position: relative;
  z-index: 2;
}

.slot.is-insecure {
  border-color: rgba(255, 95, 95, 0.75);
}

.slot-broken-overlay {
  position: absolute;
  inset: 5px;
  z-index: 5;
  background: url('/img/broken-overlay.svg') center / contain no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.75));
  pointer-events: none;
}

.slot-tint {
  position: absolute;
  width: 46px;
  height: 46px;
  background: transparent;
  z-index: 3;
  opacity: 0.7;
  mix-blend-mode: multiply;
  pointer-events: none;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.slot-fallback {
  position: absolute;
  inset: 2px;
  align-items: center;
  justify-content: center;
  padding: 2px;
  color: #f2f2f2;
  font-size: 9px;
  line-height: 1.1;
  text-align: center;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
}

.slot-text {
  display: none;
}

.slot-label {
  display: none;
}

.slot-count {
  position: absolute;
  right: 2px;
  bottom: 2px;
  min-width: 18px;
  max-width: calc(100% - 4px);
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.78);
  color: #f5f5f5;
  font-size: 10px;
  font-weight: bold;
  line-height: 1.2;
  text-align: right;
  box-sizing: border-box;
}

@media (max-width: 1180px) {
  #inventory-layout {
    flex-direction: column;
    align-items: stretch;
  }

  .slot-grid {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  }

  .slot,
  .slot-icon img {
    width: 50px;
    height: 50px;
  }
}
